Skip to content

Commit

Permalink
Wrote a catch matcher for equality of epu8
Browse files Browse the repository at this point in the history
  • Loading branch information
hivert committed Oct 27, 2023
1 parent f69a3af commit b4f1dda
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
#ifndef HPCOMBI_TESTS_TEST_MAIN_HPP_
#define HPCOMBI_TESTS_TEST_MAIN_HPP_

#include <string>

#include "epu.hpp"
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_templated.hpp>

#define TEST_AGREES(fixture, type, ref, fun, vct, tags) \
TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \
for (type p : vct) { \
Expand All @@ -39,4 +45,19 @@
} \
}


struct Equals : Catch::Matchers::MatcherGenericBase {
Equals(HPCombi::epu8 v) : v(v) {}

bool match(HPCombi::epu8 w) const { return HPCombi::equal(v, w); }

std::string describe() const override {
return "\n!=\n" + std::to_string(v);
}

private:

const HPCombi::epu8 v;
};

#endif // HPCOMBI_TESTS_TEST_MAIN_HPP_

0 comments on commit b4f1dda

Please sign in to comment.