4 #include "../application/argumentparser.h" 5 #include "../misc/traits.h" 25 operator bool()
const;
28 std::string workingCopyPathMode(
const std::string &name,
WorkingCopyMode mode)
const;
29 std::string workingCopyPath(
const std::string &name)
const;
30 int execApp(
const char *
const *args, std::string &output, std::string &errors,
bool suppressLogging =
false,
int timeout = -1)
const;
32 bool unitsSpecified()
const;
33 const std::vector<const char *> &units()
const;
43 std::string m_testFilesPathArgValue;
44 std::string m_testFilesPathEnvValue;
45 std::string m_workingDir;
56 inline TestApplication::operator bool()
const 66 return TestApplication::m_instance;
74 return m_unitsArg.isPresent();
83 return m_unitsArg.values();
122 inline CPP_UTILITIES_EXPORT int execApp(
const char *
const *args, std::string &output, std::string &errors)
133 const char *appPath,
const char *
const *args, std::string &output, std::string &errors,
bool suppressLogging =
false,
int timeout = -1);
161 template <
typename T> std::ostream &operator<<(std::ostream &out, const AsHexNumber<T> &value)
163 return out << std::hex <<
'0' <<
'x' << unsigned(value.value) << std::dec;
175 #ifndef TESTUTILS_ASSERT_EXEC 180 #define TESTUTILS_ASSERT_EXEC(args) CPPUNIT_ASSERT_EQUAL(0, execApp(args, stdout, stderr)) 186 template <
typename Iteratable, Traits::EnableIf<Traits::IsIteratable<Iteratable>, Traits::Not<Traits::IsString<Iteratable>>>...>
187 inline std::ostream &
operator<<(std::ostream &out,
const Iteratable &iteratable)
189 for (
const auto &item : iteratable)
202 constexpr std::size_t
operator"" _st(
unsigned long long size)
204 return static_cast<std::size_t
>(size);
209 #endif // TESTUTILS_H bool unitsSpecified() const
Returns whether particular units have been specified.
The TestApplication class simplifies writing test applications that require opening test files...
std::ostream & operator<<(std::ostream &out, const AsHexNumber< T > &value)
Provides the actual formatting of the output for AsHexNumber class.
AsHexNumber(const T &value)
Constructs a new instance; use asHexNumber() for convenience instead.
std::string testFilePath(const std::string &name) const
Returns the full path of the test file with the specified name.
Contains classes and functions utilizing creating of test applications.
bool operator==(const AsHexNumber< T > &lhs, const AsHexNumber< T > &rhs)
Provides operator == required by CPPUNIT_ASSERT_EQUAL.
The Argument class is a wrapper for command line argument information.
const std::vector< const char * > & units() const
Returns the specified test units.
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 sim...
WorkingCopyMode
The WorkingCopyMode enum specifies additional options to influence behavior of TestApplication::worki...
The HelpArgument class prints help information for an argument parser when present (–help...
static const TestApplication * instance()
Returns the current TestApplication instance.
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
The AsHexNumber class allows printing values asserted with cppunit (or similar test framework) using ...
CPP_UTILITIES_EXPORT std::string testFilePath(const std::string &name)
Convenience function which returns the full path of the test file with the specified name...
The ArgumentParser class provides a means for handling command line arguments.