/*
* 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
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()
{
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());