Gromacs
5.1.4
|
#include <testutils/stringtest.h>
Inherits Test.
Inherited by gmx::test::CommandLineModuleManagerTestBase.
Test fixture for tests that check string formatting.
For development, tests that use this fixture as their base can be run with a '-stdout' command-line option to print out the tested strings to stdout. If this flag is not given, they check the strings using the XML reference framework (see TestReferenceData).
Public Member Functions | |
FileOutputRedirectorInterface & | initOutputRedirector (TestFileManager *fileManager) |
Creates a redirector that directs all output to temporary files. More... | |
TestReferenceChecker & | checker () |
Returns the root checker for this test's reference data. More... | |
void | checkText (const std::string &text, const char *id) |
Checks a string. More... | |
void | checkFileContents (const std::string &filename, const char *id) |
Checks contents of a file as a single string. More... | |
void | checkRedirectedOutputFiles () |
Checks contents of all files redirected with initOutputRedirector(). More... | |
TestReferenceChecker & gmx::test::StringTestBase::checker | ( | ) |
Returns the root checker for this test's reference data.
Can be used to perform custom checks against reference data (e.g., if the test needs to check some other values than plain strings.
void gmx::test::StringTestBase::checkFileContents | ( | const std::string & | filename, |
const char * | id | ||
) |
Checks contents of a file as a single string.
[in] | filename | Name of the file to check. |
[in] | id | Unique (within a single test) id for the string. |
Provided for convenience. Reads the contents of filename
into a single string and calls checkText().
void gmx::test::StringTestBase::checkRedirectedOutputFiles | ( | ) |
Checks contents of all files redirected with initOutputRedirector().
Uses the same logic as checkFileContents() to check each file (including stdout
) that has been created using the redirector returned by initOutputRedirector().
initOutputRedirector() must have been called. This method should not be called if the redirector will still be used for further output in the test. Behavior is not designed for checking in the middle of the test, although that could potentially be changed if necessary.
void gmx::test::StringTestBase::checkText | ( | const std::string & | text, |
const char * | id | ||
) |
Checks a string.
[in] | text | String to check. |
[in] | id | Unique (within a single test) id for the string. |
FileOutputRedirectorInterface & gmx::test::StringTestBase::initOutputRedirector | ( | TestFileManager * | fileManager | ) |
Creates a redirector that directs all output to temporary files.
[in] | fileManager | File manager to use for temporary files. |
Can only be called once in a test.