ut
ut copied to clipboard
Container print overwrites user defined print
Minimal example:
#include <boost/ut.hpp>
// a user defined container like type (in practice, for example, a matrix)
struct A: std::vector<int>{ using std::vector<int>::vector; };
// with user defined print
std::ostream& operator<<(std::ostream& os, A const& a){
using namespace boost::ut;
os << "A{";
auto first = true;
for (auto const& v: a) {
os << (first ? "" : ", ") << v;
first = false;
}
os << "}";
return os;
}
int main(){
std::cout << A{0}; // used defined print
boost::ut::expect(boost::ut::eq(A{1}, A{2})); // unexpected ut container print
}
Expected Behavior
On the second output line, I would expect the user defined output to be called to get this:
A{0}
main.cpp:20:FAILED [A{1} == A{2}]
===============================================================================
tests: 0 | 0 failed
asserts: 1 | 0 passed | 1 failed
Actual Behavior
Currently the user defined output overload is ignored. Instead the UT container output is used:
A{0}
main.cpp:20:FAILED [{1} == {2}]
===============================================================================
tests: 0 | 0 failed
asserts: 1 | 0 passed | 1 failed
Steps to Reproduce the Problem
Compile and execute the minimal example.
Specifications
- Version: µt 1.1.8
- Platform: GCC 11 on 64 Bit x86 Linux