1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
//
// Created by Eduard Valeyev on 7/14/20.
//
#ifndef TILEDARRAY_TESTS_BOOST_TEST_PRINT_H_
#define TILEDARRAY_TESTS_BOOST_TEST_PRINT_H_
#include <iosfwd>
#include <vector>
// teach Boost.Test how to print std::vector
// boost printing method
namespace boost {
namespace test_tools {
namespace tt_detail {
template <typename T>
struct print_log_value<std::vector<T> > {
void operator()(std::ostream& s, const std::vector<T>& v) {
const auto sz = v.size();
if (sz == 0) {
s << "[]";
} else {
s << "[ ";
if (sz > 1)
for (std::size_t i = 0; i != sz - 2; ++i) {
s << v[i] << ", ";
}
}
s << v.back() << " ]";
}
};
} // namespace tt_detail
} // namespace test_tools
} // namespace boost
#endif // TILEDARRAY_TESTS_BOOST_TEST_PRINT_H_
|