diff --git a/test/common_helper/test.hpp b/test/common_helper/test.hpp index ffd8746..b30d6fa 100644 --- a/test/common_helper/test.hpp +++ b/test/common_helper/test.hpp @@ -253,6 +253,19 @@ inline std::ostream& operator<<(std::ostream& os, ReturnCode rc) { } } +template +constexpr auto _repeat_for_types(auto f) { + std::array rets { (f.template operator()())... }; + return rets; +} + +#define REPEAT_FOR_TYPES(func, ...) { \ + auto r = _repeat_for_types<__VA_ARGS__>(func); \ + auto it = std::ranges::find_if(r, [](auto&& e) { return e.val == ReturnCode::FAILED; }); \ + if (it != std::ranges::end(r)) { \ + return *it; \ + } \ +} #define CREATE_FROM_IL(type, il, len) \