/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
qsort(rdata, n, 2*sizeof(real), &cmp_real_range);
for (i = j = 2; i < 2*n; i += 2)
{
- if (rdata[j-1]+1 >= rdata[i])
+ if (rdata[j-1] >= rdata[i])
{
if (rdata[i+1] > rdata[j-1])
{
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <ParsedSelections Name="Parsed">
+ <ParsedSelection Name="Selection1">
+ <String Name="Input">atomnr 2 to 4 5 to 8</String>
+ <String Name="Text">atomnr 2 to 4 5 to 8</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ <ParsedSelection Name="Selection2">
+ <String Name="Input">atomnr 2 to 5 4 to 7</String>
+ <String Name="Text">atomnr 2 to 5 4 to 7</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ </ParsedSelections>
+ <CompiledSelections Name="Compiled">
+ <Selection Name="Selection1">
+ <Sequence Name="Atoms">
+ <Int Name="Length">7</Int>
+ <Int>1</Int>
+ <Int>2</Int>
+ <Int>3</Int>
+ <Int>4</Int>
+ <Int>5</Int>
+ <Int>6</Int>
+ <Int>7</Int>
+ </Sequence>
+ </Selection>
+ <Selection Name="Selection2">
+ <Sequence Name="Atoms">
+ <Int Name="Length">6</Int>
+ <Int>1</Int>
+ <Int>2</Int>
+ <Int>3</Int>
+ <Int>4</Int>
+ <Int>5</Int>
+ <Int>6</Int>
+ </Sequence>
+ </Selection>
+ </CompiledSelections>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <ParsedSelections Name="Parsed">
+ <ParsedSelection Name="Selection1">
+ <String Name="Input">charge {-0.35 to -0.05 0.25 to 0.75}</String>
+ <String Name="Text">charge {-0.35 to -0.05 0.25 to 0.75}</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ <ParsedSelection Name="Selection2">
+ <String Name="Input">charge {0.05 to -0.3 -0.05 to 0.55}</String>
+ <String Name="Text">charge {0.05 to -0.3 -0.05 to 0.55}</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ </ParsedSelections>
+ <CompiledSelections Name="Compiled">
+ <Selection Name="Selection1">
+ <Sequence Name="Atoms">
+ <Int Name="Length">8</Int>
+ <Int>2</Int>
+ <Int>3</Int>
+ <Int>4</Int>
+ <Int>8</Int>
+ <Int>9</Int>
+ <Int>10</Int>
+ <Int>11</Int>
+ <Int>12</Int>
+ </Sequence>
+ </Selection>
+ <Selection Name="Selection2">
+ <Sequence Name="Atoms">
+ <Int Name="Length">9</Int>
+ <Int>2</Int>
+ <Int>3</Int>
+ <Int>4</Int>
+ <Int>5</Int>
+ <Int>6</Int>
+ <Int>7</Int>
+ <Int>8</Int>
+ <Int>9</Int>
+ <Int>10</Int>
+ </Sequence>
+ </Selection>
+ </CompiledSelections>
+</ReferenceData>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
+TEST_F(SelectionCollectionDataTest, HandlesOverlappingIntegerRanges)
+{
+ static const char * const selections[] = {
+ "atomnr 2 to 4 5 to 8",
+ "atomnr 2 to 5 4 to 7"
+ };
+ ASSERT_NO_FATAL_FAILURE(runTest(10, selections));
+}
+
+
+TEST_F(SelectionCollectionDataTest, HandlesOverlappingRealRanges)
+{
+ static const char * const selections[] = {
+ "charge {-0.35 to -0.05 0.25 to 0.75}",
+ "charge {0.05 to -0.3 -0.05 to 0.55}"
+ };
+ ASSERT_NO_FATAL_FAILURE(runParser(selections));
+ ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
+ for (int i = 0; i < top_->atoms.nr; ++i)
+ {
+ top_->atoms.atom[i].q = i / 10.0 - 0.5;
+ }
+ ASSERT_NO_FATAL_FAILURE(runCompiler());
+}
+
+
TEST_F(SelectionCollectionDataTest, HandlesForcedStringMatchingMode)
{
static const char * const selections[] = {