Merge release-4-6 into master
[alexxy/gromacs.git] / src / testutils / testoptions.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11  * Copyright (c) 2001-2009, The GROMACS development team,
12  * check out http://www.gromacs.org for more information.
13
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * If you want to redistribute modifications, please consider that
20  * scientific software is very special. Version control is crucial -
21  * bugs must be traceable. We will be happy to consider code for
22  * inclusion in the official distribution, but derived work must not
23  * be called official GROMACS. Details are found in the README & COPYING
24  * files - if they are missing, get the official version at www.gromacs.org.
25  *
26  * To help us fund GROMACS development, we humbly ask that you cite
27  * the papers on the package - you can find them in the top README file.
28  *
29  * For more info, check our website at http://www.gromacs.org
30  */
31 /*! \libinternal \file
32  * \brief
33  * Functions for accessing test command-line options.
34  *
35  * Functions in this header allow accessing command-line options passed to the
36  * test executable from tests.  This can be used to, e.g., enable additional
37  * output for debugging purposes.
38  *
39  * \author Teemu Murtola <teemu.murtola@cbr.su.se>
40  * \inlibraryapi
41  * \ingroup module_testutils
42  */
43 #ifndef GMX_TESTUTILS_TESTOPTIONS_H
44 #define GMX_TESTUTILS_TESTOPTIONS_H
45
46 namespace gmx
47 {
48
49 class Options;
50
51 namespace test
52 {
53
54 /*! \libinternal \brief
55  * Initializes the test utilities library.
56  *
57  * Does not throw.  Terminates the program with a non-zero error code if an
58  * error occurs.
59  *
60  * This function is automatically called by test_main_gtest.cpp and
61  * test_main_gmock.cpp.
62  */
63 void initTestUtils(const char *dataPath, int *argc, char *argv[]);
64 /*! \libinternal \brief
65  * Parses given options from the command line.
66  *
67  * \param[in] options  Definition of options to parse.
68  * \throws  std::bad_alloc if out of memory.
69  * \throws  TestException if an error occurs in the parsing.
70  *
71  * This can be used from test or test fixture setup functions to initialize
72  * local variables.  Although this means that the parameters are potentially
73  * parsed multiple times, the performance impact should not be significant.
74  *
75  * \inlibraryapi
76  */
77 void parseTestOptions(Options *options);
78
79 } // namespace test
80 } // namespace gmx
81
82 #endif