diff --git a/tests/testutils.h b/tests/testutils.h index 1bf1bef..9294498 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -2,6 +2,7 @@ #define TESTUTILS_H #include "../application/argumentparser.h" +#include "../misc/traits.h" #include #include @@ -170,6 +171,17 @@ template AsHexNumber asHexNumber(const T &value) */ #define TESTUTILS_ASSERT_EXEC(args) CPPUNIT_ASSERT_EQUAL(0, execApp(args, stdout, stderr)) #endif + +/*! + * \brief Allows printing iteratable objects so those can be asserted using CPPUNIT_ASSERT_EQUAL. + */ +template , Traits::Not>>...> +inline std::ostream &operator<<(std::ostream &out, const Iteratable &iteratable) +{ + for (const auto &item : iteratable) + out << item << '\n'; + return out; +} } #endif // TESTUTILS_H