C++ Utilities
4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
Contains classes and functions utilizing creating of test applications. More...
Namespaces | |
Literals | |
Contains literals to ease asserting with CPPUNIT_ASSERT_EQUAL. | |
Classes | |
class | AsHexNumber |
The AsHexNumber class allows printing values asserted with cppunit (or similar test framework) using the hex system in the error case. More... | |
class | OutputCheck |
The StandardOutputCheck class asserts whether the (standard) output written in the enclosing code block matches the expected output. More... | |
class | TestApplication |
The TestApplication class simplifies writing test applications that require opening test files. More... | |
Enumerations | |
enum | WorkingCopyMode { WorkingCopyMode::CreateCopy, WorkingCopyMode::NoCopy } |
The WorkingCopyMode enum specifies additional options to influence behavior of TestApplication::workingCopyPathMode(). More... | |
Functions | |
CPP_UTILITIES_EXPORT std::string | testFilePath (const std::string &relativeTestFilePath) |
Convenience function to invoke TestApplication::testFilePath(). More... | |
CPP_UTILITIES_EXPORT std::string | workingCopyPath (const std::string &relativeTestFilePath) |
Convenience function to invoke TestApplication::workingCopyPath(). More... | |
CPP_UTILITIES_EXPORT std::string | workingCopyPathMode (const std::string &relativeTestFilePath, WorkingCopyMode mode) |
Convenience function to invoke TestApplication::workingCopyPathMode(). More... | |
CPP_UTILITIES_EXPORT std::string | workingCopyPathAs (const std::string &relativeTestFilePath, const std::string &relativeWorkingCopyPath, WorkingCopyMode mode=WorkingCopyMode::CreateCopy) |
Convenience function to invoke TestApplication::workingCopyPathAs(). More... | |
template<typename T > | |
bool | operator== (const AsHexNumber< T > &lhs, const AsHexNumber< T > &rhs) |
Provides operator == required by CPPUNIT_ASSERT_EQUAL. More... | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const AsHexNumber< T > &value) |
Provides the actual formatting of the output for AsHexNumber class. More... | |
template<typename T > | |
AsHexNumber< T > | asHexNumber (const T &value) |
Wraps a value to be printed using the hex system in the error case when asserted with cppunit (or similar test framework). More... | |
template<typename T , Traits::EnableIf< std::is_integral< T >> * = nullptr> | |
AsHexNumber< T > | integralsAsHexNumber (const T &value) |
Wraps a value to be printed using the hex system in the error case when asserted with cppunit (or similar test framework). More... | |
template<typename T , Traits::DisableIf< std::is_integral< T >> * = nullptr> | |
const T & | integralsAsHexNumber (const T &value) |
Wraps a value to be printed using the hex system in the error case when asserted with cppunit (or similar test framework). More... | |
template<typename Pair , Traits::EnableIf< Traits::IsSpecializationOf< Pair, std::pair >> * = nullptr> | |
std::ostream & | operator<< (std::ostream &out, const Pair &pair) |
Allows printing pairs so key/values of maps/hashes can be asserted using CPPUNIT_ASSERT_EQUAL. More... | |
template<typename Iteratable , Traits::EnableIf< Traits::IsIteratable< Iteratable >, Traits::Not< Traits::IsString< Iteratable >>> * = nullptr> | |
std::ostream & | operator<< (std::ostream &out, const Iteratable &iteratable) |
Allows printing iteratable objects so those can be asserted using CPPUNIT_ASSERT_EQUAL. More... | |
bool | fileSystemItemExists (const string &path) |
bool | fileExists (const string &path) |
bool | dirExists (const string &path) |
bool | makeDir (const string &path) |
Contains classes and functions utilizing creating of test applications.
|
strong |
The WorkingCopyMode enum specifies additional options to influence behavior of TestApplication::workingCopyPathMode().
Enumerator | |
---|---|
CreateCopy | a working copy of the test file is created |
NoCopy | only the directory for the working copy is created but not the test file itself |
Definition at line 18 of file testutils.h.
AsHexNumber<T> TestUtilities::asHexNumber | ( | const T & | value | ) |
Wraps a value to be printed using the hex system in the error case when asserted with cppunit (or similar test framework).
Definition at line 189 of file testutils.h.
bool TestUtilities::dirExists | ( | const string & | path | ) |
Definition at line 72 of file testutils.cpp.
bool TestUtilities::fileExists | ( | const string & | path | ) |
Definition at line 57 of file testutils.cpp.
bool TestUtilities::fileSystemItemExists | ( | const string & | path | ) |
Definition at line 42 of file testutils.cpp.
AsHexNumber<T> TestUtilities::integralsAsHexNumber | ( | const T & | value | ) |
Wraps a value to be printed using the hex system in the error case when asserted with cppunit (or similar test framework).
Definition at line 199 of file testutils.h.
const T& TestUtilities::integralsAsHexNumber | ( | const T & | value | ) |
Wraps a value to be printed using the hex system in the error case when asserted with cppunit (or similar test framework).
Definition at line 209 of file testutils.h.
bool TestUtilities::makeDir | ( | const string & | path | ) |
Definition at line 87 of file testutils.cpp.
std::ostream& TestUtilities::operator<< | ( | std::ostream & | out, |
const AsHexNumber< T > & | value | ||
) |
Provides the actual formatting of the output for AsHexNumber class.
Definition at line 180 of file testutils.h.
|
inline |
Allows printing pairs so key/values of maps/hashes can be asserted using CPPUNIT_ASSERT_EQUAL.
Definition at line 245 of file testutils.h.
|
inline |
Allows printing iteratable objects so those can be asserted using CPPUNIT_ASSERT_EQUAL.
Definition at line 254 of file testutils.h.
bool TestUtilities::operator== | ( | const AsHexNumber< T > & | lhs, |
const AsHexNumber< T > & | rhs | ||
) |
Provides operator == required by CPPUNIT_ASSERT_EQUAL.
Definition at line 172 of file testutils.h.
|
inline |
Convenience function to invoke TestApplication::testFilePath().
Definition at line 107 of file testutils.h.
|
inline |
Convenience function to invoke TestApplication::workingCopyPath().
Definition at line 116 of file testutils.h.
|
inline |
Convenience function to invoke TestApplication::workingCopyPathAs().
Definition at line 134 of file testutils.h.
|
inline |
Convenience function to invoke TestApplication::workingCopyPathMode().
Definition at line 125 of file testutils.h.