/*
* 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
* Provides additional options for the test executable.
*
* Typically not used directly in test code, but through the
- * GMX_TEST_OPTIONS macro.
+ * #GMX_TEST_OPTIONS macro.
*
* \inlibraryapi
* \ingroup module_testutils
* \throws tMPI::system_error on mutex failures.
*
* Typically not used directly in test code, but through the
- * GMX_TEST_OPTIONS macro.
+ * #GMX_TEST_OPTIONS macro.
*
* This gets called from constructors for global variables, so ideally
* it would not throw to avoid unhandled exceptions. But since this
*/
void registerTestOptions(const char *name, TestOptionsProvider *provider);
+// Uncrustify screws up the indentation for the example otherwise.
+/* *INDENT-OFF* */
/*! \libinternal \brief
* Macro to add additional command-line options for the test binary.
*
+ * \param name Unique name for the set of options.
+ * \param options Placeholder name for an gmx::Options object for adding options.
+ *
+ * The macro should be followed by a block that adds the desired command-line
+ * options to `options` using gmx::Options::addOption(). \ref module_options
+ * provides an overview of the options machinery.
+ *
+ * `name` must be unique within the executable to which the options are added.
+ * If the macro is within an unnamed namespace, then it is sufficient that it
+ * is unique within the file.
+ *
* Typical usage:
* \code
+ #include "gromacs/options/basicoptions.h"
+ #include "gromacs/options/options.h"
+
+ #include "testutils/testoptions.h"
+
+ namespace gmx
+ {
namespace
{
bool g_optionValue = false;
+ //! \cond
GMX_TEST_OPTIONS(MyTestOptions, options)
{
- options->addOption(BooleanOption("-flag").store(g_optionValue)
+ options->addOption(BooleanOption("flag").store(&g_optionValue)
.description("My description"));
}
+ //! \endcond
} // namespace
- * \endcode
+ } // namespace gmx
+ \endcode
+ *
+ * \c \\cond and \c \\endcond statements are necessary around the macro to avoid
+ * Doxygen warnings.
*
* One macro invocation per an added option, with more of the implementation
* details hidden inside the macro, could be nicer. But that requires more
* complexity.
*
* \ingroup module_testutils
+ * \hideinitializer
*/
+/* *INDENT-ON* */
#define GMX_TEST_OPTIONS(name, options) \
class name : public ::gmx::test::TestOptionsProvider \
{ \
virtual void initOptions(::gmx::Options *options); \
}; \
\
- static name s_##name##Instance; \
+ static name s_ ## name ## Instance; \
\
void name::initOptions(::gmx::Options *options)
*
* This function is automatically called by unittest_main.cpp.
*/
-void initTestUtils(const char *dataPath, int *argc, char *argv[]);
+void initTestUtils(const char *dataPath, const char *tempPath, int *argc, char ***argv);
+
+/*! \libinternal \brief
+ * Finalizes the test utilities library.
+ *
+ * Does not throw. Terminates the program with a non-zero error code if an
+ * error occurs.
+ *
+ * This function is automatically called by unittest_main.cpp.
+ */
+void finalizeTestUtils();
} // namespace test
} // namespace gmx