Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / selection / tests / selectioncollection.cpp
index 4475798b5dfa12c9ed1ad1e6af98f908da29ba97..500bfa5aae4f332d67a7886d10add05b1c1e3277 100644 (file)
@@ -488,7 +488,9 @@ TEST_F(SelectionCollectionTest, HandlesUnknownGroupReferenceDelayed2)
     EXPECT_THROW_GMX(sc_.compile(), gmx::APIError);
 }
 
-TEST_F(SelectionCollectionTest, HandlesUnsortedGroupReference)
+// TODO: Make the check less eager so that it doesn't break other tests, and
+// adapt these tests accordingly.
+TEST_F(SelectionCollectionTest, DISABLED_HandlesUnsortedGroupReference)
 {
     ASSERT_NO_THROW_GMX(loadIndexGroups("simple.ndx"));
     EXPECT_THROW_GMX(sc_.parseFromString("group \"GrpUnsorted\""),
@@ -496,7 +498,7 @@ TEST_F(SelectionCollectionTest, HandlesUnsortedGroupReference)
     EXPECT_THROW_GMX(sc_.parseFromString("2"), gmx::InconsistentInputError);
 }
 
-TEST_F(SelectionCollectionTest, HandlesUnsortedGroupReferenceDelayed)
+TEST_F(SelectionCollectionTest, DISABLED_HandlesUnsortedGroupReferenceDelayed)
 {
     ASSERT_NO_THROW_GMX(sc_.parseFromString("group 2; group \"GrpUnsorted\""));
     EXPECT_THROW_GMX(loadIndexGroups("simple.ndx"), gmx::InconsistentInputError);
@@ -925,6 +927,21 @@ TEST_F(SelectionCollectionDataTest, HandlesIndexGroupsInSelectionsDelayed)
     ASSERT_NO_FATAL_FAILURE(runCompiler());
 }
 
+TEST_F(SelectionCollectionDataTest, HandlesUnsortedIndexGroupsInSelections)
+{
+    static const char * const selections[] = {
+        "group \"GrpUnsorted\"",
+        "GrpUnsorted",
+        "2",
+        "res_cog of group \"GrpUnsorted\"",
+        "group \"GrpUnsorted\" permute 2 1"
+    };
+    setFlags(TestFlags() | efTestPositionAtoms | efTestPositionMapping
+             | efTestSelectionNames);
+    ASSERT_NO_THROW_GMX(loadIndexGroups("simple.ndx"));
+    runTest("simple.gro", selections);
+}
+
 TEST_F(SelectionCollectionDataTest, HandlesConstantPositions)
 {
     static const char * const selections[] = {