/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2019,2021, 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.
*/
#include "gmxpre.h"
+#include "gromacs/utility/stringutil.h"
+#include "gromacs/gmxpreprocess/readir.h"
+
#include <gtest/gtest.h>
#include "moduletest.h"
+#include "testutils/testexceptions.h"
+
namespace
{
runTest();
}
+#if HAVE_MUPARSER
+
+TEST_F(GromppTest, ValidTransformationCoord)
+{
+ const char* inputMdpFile[] = {
+ "pull = yes",
+ "pull-ncoords = 2",
+ "pull-ngroups = 2",
+ "pull-group1-name = SOL",
+ "pull-group2-name = Methanol",
+ "pull-coord1-geometry = distance",
+ "pull-coord1-groups = 1 2",
+ "pull-coord2-geometry = transformation",
+ "pull-coord2-expression = x1", // Valid expression
+ };
+ runner_.useStringAsMdpFile(gmx::joinStrings(inputMdpFile, "\n"));
+ runTest();
+}
+
+TEST_F(GromppTest, InvalidTransformationCoord)
+{
+ const char* inputMdpFile[] = {
+ "pull = yes",
+ "pull-ncoords = 2",
+ "pull-ngroups = 2",
+ "pull-group1-name = SOL",
+ "pull-group2-name = Methanol",
+ "pull-coord1-geometry = distance",
+ "pull-coord1-groups = 1 2",
+ "pull-coord2-geometry = transformation",
+ "pull-coord2-expression = x2", // Invalid expression -> evaluation should fail
+ };
+ runner_.useStringAsMdpFile(gmx::joinStrings(inputMdpFile, "\n"));
+ ASSERT_THROW(runTest(), gmx::InconsistentInputError);
+ done_inputrec_strings(); // This allows grompp to be called again in another test
+}
+#endif // HAVE_MUPARSER
+
} // namespace