Sort includes outside src/gromacs
[alexxy/gromacs.git] / src / testutils / stringtest.cpp
index 8df4c3f1f1557c27a8e82013d68a7bae0537db95..93b8bf9c757d4be8d4c02090f95a7b096f9d38ad 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012, 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_testutils
  */
-#include "testutils/stringtest.h"
+#include "gmxpre.h"
+
+#include "stringtest.h"
 
 #include "gromacs/options/basicoptions.h"
 #include "gromacs/options/options.h"
 #include "gromacs/utility/file.h"
+
 #include "testutils/testoptions.h"
 
 namespace gmx
@@ -51,14 +54,24 @@ namespace gmx
 namespace test
 {
 
-bool StringTestBase::s_bWriteToStdOut = false;
+namespace
+{
+//! Stores the -stdout flag value to print out values instead of checking them.
+bool g_bWriteToStdOut = false;
+}
 
-void StringTestBase::SetUpTestCase()
+// TODO: Only add this option to those test binaries that actually need it
+// (depending on the linker, it may or may not appear right now),
+// or replace by a generic mechanism in TestReferenceData.
+//! \cond
+GMX_TEST_OPTIONS(StringTestOptions, options)
 {
-    Options options(NULL, NULL);
-    options.addOption(BooleanOption("stdout").store(&s_bWriteToStdOut));
-    parseTestOptions(&options);
+    options->addOption(
+            BooleanOption("stdout")
+                .store(&g_bWriteToStdOut)
+                .description("Print the test string to stdout instead of checking against reference data"));
 }
+//! \endcond
 
 StringTestBase::StringTestBase()
 {
@@ -81,7 +94,7 @@ StringTestBase::checker()
 void
 StringTestBase::checkText(const std::string &text, const char *id)
 {
-    if (s_bWriteToStdOut)
+    if (g_bWriteToStdOut)
     {
         printf("%s:\n", id);
         printf("%s[END]\n", text.c_str());