diff --git a/tools/test/include/psemek/test/test.hpp b/tools/test/include/psemek/test/test.hpp index 055b93d5..129c5ad7 100644 --- a/tools/test/include/psemek/test/test.hpp +++ b/tools/test/include/psemek/test/test.hpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include // Have to put it before including to_string.hpp due to how unqualified lookup works, // see e.g. https://alexanderlobov.net/posts/2019-07-08-function-lookup-in-templates @@ -18,6 +20,24 @@ std::ostream & operator << (std::ostream & s, std::optional const & o) return s; } +template +std::ostream & operator << (std::ostream & s, std::pair const & p) +{ + s << '(' << p.first << ", " << p.second << ')'; + return s; +} + +template +std::ostream & operator << (std::ostream & s, std::tuple const & t) +{ + s << '('; + [&](std::index_sequence){ + ((s << (Is == 0 ? "" : ", ") << std::get(t)), ...); + }(std::make_index_sequence{}); + s << ')'; + return s; +} + #include namespace psemek::test