From b36572a4dd735a4fc39096ea9633ee6553ee327b Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 6 Aug 2016 22:02:14 +0200 Subject: [PATCH] Add macro to assert execution of application --- conversion/stringconversion.h | 2 -- tests/testutils.h | 11 ++++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/conversion/stringconversion.h b/conversion/stringconversion.h index 97db76e..d1e42b2 100644 --- a/conversion/stringconversion.h +++ b/conversion/stringconversion.h @@ -13,8 +13,6 @@ #include #include -//#include - namespace ConversionUtilities { diff --git a/tests/testutils.h b/tests/testutils.h index 4c4455e..099a7f3 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -135,13 +135,22 @@ template std::ostream &operator<< (std::ostream &out, const AsHexNu } /*! - * \brief Wraps the value to be printed using the hex system. + * \brief Wraps a value to be printed using the hex system in the error case when asserted + * with cppunit (or similar test framework). */ template AsHexNumber asHexNumber(const T &value) { return AsHexNumber(value); } +#ifndef TESTUTILS_ASSERT_EXEC +/*! + * \brief Asserts successful execution of application via TestApplication::execApp(). Output is stored in stdout and stderr. + * \remarks Requires cppunit. + */ +# define TESTUTILS_ASSERT_EXEC(args) CPPUNIT_ASSERT_EQUAL(0, execApp(args, stdout, stderr)) +#endif + } #endif // TESTUTILS_H