Gromacs  2019.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::test::CommandLineTestBase Class Reference

#include <testutils/cmdlinetest.h>

+ Inheritance diagram for gmx::test::CommandLineTestBase:

Description

Test fixture for tests that call a single command-line program with input/output files.

This class provides a convenient package for using CommandLineTestHelper in a test that do not need special customization. It takes care of creating the other necessary objects (like TestFileManager, TestReferenceData, and CommandLine) and wrapping the methods from CommandLineTestHelper such that extra parameters are not needed. Additionally, it provides setInputFile() as a convenience function for adding a fixed input file, pointing to a file that resides in the source tree.

See Also
CommandLineTestHelper

Public Member Functions

void setInputFile (const char *option, const char *filename)
 Sets an input file. More...
 
void setInputFile (const char *option, const std::string &filename)
 Sets an input file. More...
 
void setInputFileContents (const char *option, const char *extension, const std::string &contents)
 Generates and sets an input file. More...
 
void setInputFileContents (const char *option, const char *extension, const ArrayRef< const char *const > &contents)
 Generates and sets an input file. More...
 
void setOutputFile (const char *option, const char *filename, const ITextBlockMatcherSettings &matcher)
 Sets an output file parameter and adds it to the set of tested files. More...
 
void setOutputFile (const char *option, const char *filename, const IFileMatcherSettings &matcher)
 Sets an output file parameter and adds it to the set of tested files. More...
 
CommandLinecommandLine ()
 Returns the internal CommandLine object used to construct the command line for the test. More...
 
TestFileManagerfileManager ()
 Returns the internal TestFileManager object used to manage the files. More...
 
TestReferenceChecker rootChecker ()
 Returns the root reference data checker. More...
 
void setDefaultTolerance (const FloatingPointTolerance &tolerance)
 Sets the tolerance for floating-point comparisons. More...
 
void testWriteHelp (ICommandLineModule *module)
 Checks the output of writeHelp() against reference data.
 
void checkOutputFiles ()
 Checks output files added with setOutputFile() against reference data. More...
 

Member Function Documentation

void gmx::test::CommandLineTestBase::checkOutputFiles ( )

Checks output files added with setOutputFile() against reference data.

See Also
CommandLineTestHelper::checkOutputFiles()
CommandLine & gmx::test::CommandLineTestBase::commandLine ( )

Returns the internal CommandLine object used to construct the command line for the test.

Derived test fixtures can use this to add additional options, and to access the final command line to do the actual call that is being tested.

Does not throw.

TestFileManager & gmx::test::CommandLineTestBase::fileManager ( )

Returns the internal TestFileManager object used to manage the files.

Derived test fixtures can use this to manage files in cases the canned methods are not sufficient.

Does not throw.

TestReferenceChecker gmx::test::CommandLineTestBase::rootChecker ( )

Returns the root reference data checker.

Derived test fixtures can use this to check other things than output file contents.

void gmx::test::CommandLineTestBase::setDefaultTolerance ( const FloatingPointTolerance tolerance)

Sets the tolerance for floating-point comparisons.

All following floating-point comparisons using the checker will use the new tolerance.

Does not throw.

void gmx::test::CommandLineTestBase::setInputFile ( const char *  option,
const char *  filename 
)

Sets an input file.

Parameters
[in]optionOption to set.
[in]filenameName of the input file.
See Also
TestFileManager::getInputFilePath()
void gmx::test::CommandLineTestBase::setInputFile ( const char *  option,
const std::string &  filename 
)

Sets an input file.

Parameters
[in]optionOption to set.
[in]filenameName of the input file.
See Also
TestFileManager::getInputFilePath()
void gmx::test::CommandLineTestBase::setInputFileContents ( const char *  option,
const char *  extension,
const std::string &  contents 
)

Generates and sets an input file.

See Also
CommandLineTestHelper::setInputFileContents()
void gmx::test::CommandLineTestBase::setInputFileContents ( const char *  option,
const char *  extension,
const ArrayRef< const char *const > &  contents 
)

Generates and sets an input file.

See Also
CommandLineTestHelper::setInputFileContents()
void gmx::test::CommandLineTestBase::setOutputFile ( const char *  option,
const char *  filename,
const ITextBlockMatcherSettings matcher 
)

Sets an output file parameter and adds it to the set of tested files.

See Also
CommandLineTestHelper::setOutputFile()
void gmx::test::CommandLineTestBase::setOutputFile ( const char *  option,
const char *  filename,
const IFileMatcherSettings matcher 
)

Sets an output file parameter and adds it to the set of tested files.

See Also
CommandLineTestHelper::setOutputFile()

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