Gromacs  2021-sycl
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions
gmx::test::StringTestBase Class Reference

#include <testutils/stringtest.h>

Inherits Test.

Inherited by gmx::test::CommandLineModuleManagerTestBase.

Description

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

TestReferenceCheckerchecker ()
 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...
 

Member Function Documentation

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.

Parameters
[in]filenameName of the file to check.
[in]idUnique (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::checkText ( TestReferenceChecker checker,
const std::string &  text,
const char *  id 
)
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.

Parameters
[in]textString to check.
[in]idUnique (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.

Parameters
[in]refFilenameFile with the expected contents.
[in]testFilenameFile with the contents to be tested.

The documentation for this class was generated from the following files: