Add tests for setStringEntry
authorJoe Jordan <ejjordan12@gmail.com>
Fri, 2 Oct 2020 10:23:04 +0000 (10:23 +0000)
committerAndrey Alekseenko <al42and@gmail.com>
Fri, 2 Oct 2020 10:23:04 +0000 (10:23 +0000)
src/gromacs/fileio/tests/readinp.cpp

index b1aa6641828bd1c4328445bd135c2ff4bd188f4d..343a15f19b9b8e6f6bf837fc94ca82c6339cbb46 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, 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.
@@ -131,5 +131,16 @@ TEST_F(ReadTest, get_ereal_WarnsAboutString)
     ASSERT_TRUE(warning_errors_exist(wi_));
 }
 
+TEST_F(ReadTest, setStringEntry_ReturnsCorrectString)
+{
+    const std::string name        = "name";
+    const std::string definition  = "definition";
+    const std::string returnValue = setStringEntry(&inputField_, name, definition);
+    // The definition should be returned
+    EXPECT_EQ(returnValue, definition);
+    // The name should not be returned
+    EXPECT_NE(returnValue, name);
+}
+
 } // namespace testing
 } // namespace gmx