Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / selection / tests / selectioncollection.cpp
index f17c17d2b3143ebe4b6bb9af1a9741ff65d454bc..8521a27d444767bb0e6bedd6768cb07f3564174e 100644 (file)
@@ -1061,6 +1061,32 @@ TEST_F(SelectionCollectionDataTest, HandlesWithinConstantPositions)
 }
 
 
+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[] = {
@@ -1128,6 +1154,16 @@ TEST_F(SelectionCollectionDataTest, HandlesEmptySelectionWithUnevaluatedExpressi
 }
 
 
+TEST_F(SelectionCollectionDataTest, HandlesEmptyReferenceForSame)
+{
+    static const char * const selections[] = {
+        "same residue as none",
+        "same resname as none"
+    };
+    runTest("simple.gro", selections);
+}
+
+
 TEST_F(SelectionCollectionDataTest, HandlesPositionModifiersForKeywords)
 {
     static const char * const selections[] = {