C++ Utilities  4.11.0
Common C++ classes and routines used by my applications such as argument parser, IO and conversion utilities
Public Member Functions | Static Public Member Functions | List of all members
TestUtilities::TestApplication Class Reference

The TestApplication class simplifies writing test applications that require opening test files. More...

#include <testutils.h>

Public Member Functions

 TestApplication (int argc, char **argv)
 Constructs a TestApplication instance. More...
 
 ~TestApplication ()
 Destroys the TestApplication. More...
 
 operator bool () const
 Returns whether the TestApplication instance is valid. More...
 
std::string testFilePath (const std::string &name) const
 Returns the full path of the test file with the specified name. More...
 
bool unitsSpecified () const
 Returns whether particular units have been specified. More...
 
const std::vector< const char * > & units () const
 Returns the specified test units. More...
 

Static Public Member Functions

static const TestApplicationinstance ()
 Returns the current TestApplication instance. More...
 
static const char * appPath ()
 Returns the application path or an empty string if no application path has been set. More...
 

Detailed Description

The TestApplication class simplifies writing test applications that require opening test files.

Remarks
Only one instance is allowed at a time (singletone class).

Definition at line 22 of file testutils.h.

Constructor & Destructor Documentation

◆ TestApplication()

TestUtilities::TestApplication::TestApplication ( int  argc,
char **  argv 
)

Constructs a TestApplication instance.

Exceptions
Throwsstd::runtime_error if an instance has already been created.

Definition at line 48 of file testutils.cpp.

◆ ~TestApplication()

TestUtilities::TestApplication::~TestApplication ( )

Destroys the TestApplication.

Definition at line 145 of file testutils.cpp.

Member Function Documentation

◆ appPath()

const char * TestUtilities::TestApplication::appPath ( )
inlinestatic

Returns the application path or an empty string if no application path has been set.

Definition at line 78 of file testutils.h.

◆ instance()

const TestApplication * TestUtilities::TestApplication::instance ( )
inlinestatic

Returns the current TestApplication instance.

Definition at line 70 of file testutils.h.

◆ operator bool()

TestUtilities::TestApplication::operator bool ( ) const
inline

Returns whether the TestApplication instance is valid.

An instance is considered invalid if an error occured when parsing the command line arguments.

Definition at line 62 of file testutils.h.

◆ testFilePath()

string TestUtilities::TestApplication::testFilePath ( const std::string &  name) const

Returns the full path of the test file with the specified name.

Definition at line 153 of file testutils.cpp.

◆ units()

const std::vector< const char * > & TestUtilities::TestApplication::units ( ) const
inline

Returns the specified test units.

Remarks
The units argument must be present.

Definition at line 95 of file testutils.h.

◆ unitsSpecified()

bool TestUtilities::TestApplication::unitsSpecified ( ) const
inline

Returns whether particular units have been specified.

Definition at line 86 of file testutils.h.


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