From 5153c1a32c8113cf28f46f123c9c0290f5cf39bc Mon Sep 17 00:00:00 2001 From: Florent Hivert Date: Thu, 9 Nov 2023 11:57:32 +0000 Subject: [PATCH] Quick Matcher for Epu8 --- tests/test_epu8.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/test_epu8.cpp b/tests/test_epu8.cpp index f85870fd..bb77f57e 100644 --- a/tests/test_epu8.cpp +++ b/tests/test_epu8.cpp @@ -24,8 +24,13 @@ namespace HPCombi { -auto IsSorted = - Catch::Matchers::Predicate(is_sorted, "is_sorted"); +#define Epu8Match(F) Catch::Matchers::Predicate(F, "F") + +#define Epu8MatchNot(F) \ + Catch::Matchers::Predicate([](epu8 x) { return !F(x); }, #F) + +auto IsSorted = Epu8Match(is_sorted); + struct Fix { Fix() @@ -133,9 +138,9 @@ TEST_CASE_METHOD(Fix, "Epu8::last_diff_mask", "[Epu8][005]") { } TEST_CASE_METHOD(Fix, "Epu8::is_all_zero", "[Epu8][006]") { - CHECK(is_all_zero(zero)); + CHECK_THAT(zero, Epu8Match(is_all_zero)); for (size_t i = 1; i < v.size(); i++) { - CHECK(!is_all_zero(v[i])); + CHECK_THAT(v[i], Epu8MatchNot(is_all_zero)); } }