testutils: Allow asserting maps/hashes
This commit is contained in:
parent
ab42e9d96c
commit
cf4789e94d
|
@ -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…
Reference in New Issue