#if !defined(REQUIRE_EQUAL_CONTAINERS_H) #define REQUIRE_EQUAL_CONTAINERS_H #include #include #include #if BOOST_VERSION >= 105900 namespace boost { namespace test_tools { namespace tt_detail { // teach Boost.Test how to print std::vector template inline std::ostream &operator<<(std::ostream &str, std::vector const &items) { str << '['; bool first = true; for (auto const& element : items) { str << (!first ? "," : "") << element; first = false; } return str << ']'; } // teach Boost.Test how to print std::pair template inline std::ostream &operator<<(std::ostream &str, std::pair const& item) { return str << '<' << item.first << ',' << item.second << '>'; } } // namespace tt_detail } // namespace test_tools } // namespace boost #else // BOOST_VERSION < 105900 namespace boost { // teach Boost.Test how to print std::vector to wrap_stringstream template inline wrap_stringstream& operator<<(wrap_stringstream& wrapped, std::vector const& item) { wrapped << '['; bool first = true; for (auto const& element : item) { wrapped << (!first ? "," : "") << element; first = false; } return wrapped << ']'; } // teach Boost.Test how to print std::pair to wrap_stringstream template inline wrap_stringstream &operator<<(wrap_stringstream &str, std::pair const& item) { return str << '<' << item.first << ',' << item.second << '>'; } namespace test_tools { // teach Boost.Test how to print std::pair with BOOST_REQUIRE_EQUAL template<> struct print_log_value> { void operator()(std::ostream& ostr, std::pair const& item) { ostr << '<' << item.first << ',' << item.second << '>'; } }; } // namespace test_tools } // namespace boost #endif // BOOST_VERSION #define REQUIRE_EQUAL_CONTAINERS(left_, right_) \ BOOST_REQUIRE_EQUAL_COLLECTIONS(left_.begin(), left_.end(), right_.begin(), right_.end()) #endif