Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / trajectoryanalysis / tests / angle.cpp
index a1c13501e5e240e2f25d57d49a2f863044991d93..94701813fb08dd994ced5de2174cef7c121a2787 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2012,2013,2014, 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.
  *
  * GROMACS is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_trajectoryanalysis
  */
-#include <gtest/gtest.h>
+#include "gmxpre.h"
 
 #include "gromacs/trajectoryanalysis/modules/angle.h"
 
+#include <gtest/gtest.h>
+
 #include "testutils/cmdlinetest.h"
 
 #include "moduletest.h"
@@ -57,7 +59,7 @@ using gmx::test::CommandLine;
  */
 
 //! Test fixture for the angle analysis module.
-typedef gmx::test::TrajectoryAnalysisModuleTestFixture<gmx::analysismodules::Angle>
+typedef gmx::test::TrajectoryAnalysisModuleTestFixture<gmx::analysismodules::AngleInfo>
     AngleModuleTest;
 
 TEST_F(AngleModuleTest, ComputesSimpleAngles)
@@ -68,7 +70,7 @@ TEST_F(AngleModuleTest, ComputesSimpleAngles)
         "-binw", "60"
     };
     setTopology("angle.gro");
-    runTest(CommandLine::create(cmdline));
+    runTest(CommandLine(cmdline));
 }
 
 TEST_F(AngleModuleTest, ComputesDihedrals)
@@ -79,7 +81,7 @@ TEST_F(AngleModuleTest, ComputesDihedrals)
         "-binw", "120"
     };
     setTopology("angle.gro");
-    runTest(CommandLine::create(cmdline));
+    runTest(CommandLine(cmdline));
 }
 
 TEST_F(AngleModuleTest, ComputesVectorPairAngles)
@@ -91,7 +93,7 @@ TEST_F(AngleModuleTest, ComputesVectorPairAngles)
         "-binw", "60"
     };
     setTopology("angle.gro");
-    runTest(CommandLine::create(cmdline));
+    runTest(CommandLine(cmdline));
 }
 
 TEST_F(AngleModuleTest, ComputesVectorPlanePairAngles)
@@ -103,7 +105,7 @@ TEST_F(AngleModuleTest, ComputesVectorPlanePairAngles)
         "-binw", "60"
     };
     setTopology("angle.gro");
-    runTest(CommandLine::create(cmdline));
+    runTest(CommandLine(cmdline));
 }
 
 TEST_F(AngleModuleTest, ComputesPlaneZAxisAngles)
@@ -115,7 +117,7 @@ TEST_F(AngleModuleTest, ComputesPlaneZAxisAngles)
         "-binw", "60"
     };
     setTopology("angle.gro");
-    runTest(CommandLine::create(cmdline));
+    runTest(CommandLine(cmdline));
 }
 
 TEST_F(AngleModuleTest, ComputesVectorSphereNormalZAxisAngles)
@@ -127,7 +129,7 @@ TEST_F(AngleModuleTest, ComputesVectorSphereNormalZAxisAngles)
         "-binw", "60"
     };
     setTopology("angle.gro");
-    runTest(CommandLine::create(cmdline));
+    runTest(CommandLine(cmdline));
 }
 
 TEST_F(AngleModuleTest, ComputesVectorTimeZeroAngles)
@@ -140,7 +142,65 @@ TEST_F(AngleModuleTest, ComputesVectorTimeZeroAngles)
     };
     setTopology("angle.gro");
     setTrajectory("angle.gro");
-    runTest(CommandLine::create(cmdline));
+    runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, ComputesMultipleAngles)
+{
+    const char *const cmdline[] = {
+        "angle",
+        "-g1", "vector",
+        "-group1",
+        "resname RV1 RV2 and name A1 A2",
+        "resname RV3 RV4 and name A1 A2",
+        "-g2", "plane",
+        "-group2",
+        "resname RP1 RP2 and name A1 A2 A3",
+        "resname RP1 RP2 and name A1 A2 A3",
+        "-binw", "60"
+    };
+    setTopology("angle.gro");
+    runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, HandlesDynamicSelections)
+{
+    const char *const cmdline[] = {
+        "angle",
+        "-g1", "angle", "-group1", "resname RA1 RA2 and name A1 A2 A3 and z < 0.5",
+        "-binw", "60"
+    };
+    setTopology("angle.gro");
+    runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, HandlesOneVsMultipleVectorAngles)
+{
+    const char *const cmdline[] = {
+        "angle",
+        "-g1", "vector", "-group1", "resname RV1 RV2 and name A1 A2",
+        "-g2", "vector", "-group2", "resname RV3 and name A1 A2",
+        "-binw", "60"
+    };
+    setTopology("angle.gro");
+    runTest(CommandLine(cmdline));
+}
+
+TEST_F(AngleModuleTest, HandlesOneVsMultipleVectorGroupsAngles)
+{
+    const char *const cmdline[] = {
+        "angle",
+        "-g1", "vector",
+        "-group1",
+        "resname RV1 and name A1 A2",
+        "resname RV3 RV4 and name A1 A2",
+        "-g2", "plane",
+        "-group2",
+        "resname RP1 RP2 and name A1 A2 A3",
+        "-binw", "60"
+    };
+    setTopology("angle.gro");
+    runTest(CommandLine(cmdline));
 }
 
 } // namespace