diff --git a/test/yulPhaser/TestHelpers.h b/test/yulPhaser/TestHelpers.h index 2bf755b18..514d2eda7 100644 --- a/test/yulPhaser/TestHelpers.h +++ b/test/yulPhaser/TestHelpers.h @@ -33,12 +33,39 @@ #include #include +#include + #include #include #include #include +#include #include +// OPERATORS FOR BOOST::TEST + +/// Output operator for arbitrary two-element tuples. +/// Necessary to make BOOST_TEST() work with such tuples. +template +std::ostream& operator<<(std::ostream& _output, std::tuple const& _tuple) +{ + _output << "(" << std::get<0>(_tuple) << ", " << std::get<1>(_tuple) << ")"; + return _output; +} + +namespace boost::test_tools::tt_detail +{ + +// Boost won't find find the << operator unless we put it in the std namespace which is illegal. +// The recommended solution is to overload print_log_value<> struct and make it use our global operator. +template +struct print_log_value> +{ + void operator()(std::ostream& _output, std::tuple const& _tuple) { ::operator<<(_output, _tuple); } +}; + +} + namespace solidity::phaser::test {