Browse Source

testutils: Allow asserting maps/hashes

experiment/improve_get_date_part
Martchus 5 years ago
parent
commit
cf4789e94d
  1. 9
      tests/testutils.h

9
tests/testutils.h

@ -189,6 +189,15 @@ template <typename T> AsHexNumber<T> asHexNumber(const T &value)
#define TESTUTILS_ASSERT_EXEC(args) CPPUNIT_ASSERT_EQUAL(0, execApp(args, stdout, stderr))
#endif
/*!
* \brief Allows printing pairs so key/values of maps/hashes can be asserted using CPPUNIT_ASSERT_EQUAL.
*/
template <typename Pair, Traits::EnableIf<Traits::IsSpecializationOf<Pair, std::pair>>...>
inline std::ostream &operator<<(std::ostream &out, const Pair &pair)
{
return out << "key: " << pair.first << "; value: " << pair.second << '\n';
}
/*!
* \brief Allows printing iteratable objects so those can be asserted using CPPUNIT_ASSERT_EQUAL.
*/

Loading…
Cancel
Save