Gromacs
2019.3
|
#include <testutils/stringtest.h>
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).
Tests that need simple checking of a string, or container of strings, should consider the normal implementation in TestReferenceChecker.
Public Member Functions | |
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 | testFilesEqual (const std::string &refFilename, const std::string &testFilename) |
Tests that contents of two files are equal. More... | |
Static Public Member Functions | |
static void | checkText (TestReferenceChecker *checker, const std::string &text, const char *id) |
Checks a block of text. 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().
|
static |
Checks a block of text.
This static method is provided for code that does not derive from StringTestBase to use the same functionality, e.g., implementing the -stdout
option.
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. |
void gmx::test::StringTestBase::testFilesEqual | ( | const std::string & | refFilename, |
const std::string & | testFilename | ||
) |
Tests that contents of two files are equal.
[in] | refFilename | File with the expected contents. |
[in] | testFilename | File with the contents to be tested. |