From 3a1843f558466ead4a1b8546dc9bf54d2bd5588e Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Tue, 24 Oct 2023 11:09:30 +0200 Subject: [PATCH] tests: stop using boost tests --- etc/test-renumber.sh | 52 ++ tests/CMakeLists.txt | 32 +- tests/test_bmat8.cpp | 725 +++++++++++------------ tests/test_epu.cpp | 1245 +++++++++++++++++++-------------------- tests/test_main.cpp | 38 ++ tests/test_main.hpp | 42 ++ tests/test_perm16.cpp | 857 +++++++++++++-------------- tests/test_perm_all.cpp | 533 +++++++++-------- 8 files changed, 1788 insertions(+), 1736 deletions(-) create mode 100755 etc/test-renumber.sh create mode 100644 tests/test_main.cpp create mode 100644 tests/test_main.hpp diff --git a/etc/test-renumber.sh b/etc/test-renumber.sh new file mode 100755 index 00000000..dfea653e --- /dev/null +++ b/etc/test-renumber.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -e + +bold() { + printf "\033[1m%s\033[0m\n" "$*" +} + +re='^[0-9]+$' + +if [[ $# -ne 1 && $# -ne 2 ]]; then + bold "error expected 1 or 2 arguments, got $#!" + exit 1 +elif [[ ! -f $1 ]]; then + bold "Error, expected a file as first argument, $1 is not a file!" + exit 1 +elif [[ $# -eq 2 && ! $2 =~ $re ]]; then + bold "Error, expected a positive integer as second argument, $2 is not a positive integer!" + exit 1 +fi + +if [[ $# -eq 2 ]]; then + export START="$2" +else + export START=0 +fi + +FNAME="$1" python3 - < -#include -#include - -#include "epu.hpp" -#include "bmat8.hpp" #include +#include +#include -using namespace HPCombi; - -#define EPU8_EQUAL(p1, p2) BOOST_CHECK_PREDICATE(equal, (p1)(p2)) -#define EPU8_NOT_EQUAL(p1, p2) BOOST_CHECK_PREDICATE(boost::not2(equal), (p1)(p2)) - -#define TEST_AGREES(type, ref, fun, vct) \ - BOOST_FIXTURE_TEST_CASE(type##_agrees_##fun, Fix) { \ - for (type p : vct) BOOST_TEST(p.fun() == p.ref()); \ - } -#define TEST_EPU8_AGREES(type, ref, fun, vct) \ - BOOST_FIXTURE_TEST_CASE(type##_agrees_##fun, Fix) { \ - for (type p : vct) EPU8_EQUAL(p.fun(), p.ref()); \ - } - -#define TEST_AGREES2(type, ref, fun, vct) \ - BOOST_FIXTURE_TEST_CASE(type##_agrees_##fun, Fix) { \ - for (type p1 : vct) for (type p2 : vct) \ - BOOST_TEST(p1.fun(p2) == p1.ref(p2)); \ - } +#include "test_main.hpp" +#include -struct Fix { - Fix() : zero(0), one1(1), one2(0x201), - ones(0xffffffffffffffff), - bm({{0, 0, 0, 1, 0, 0, 1, 1}, - {1, 1, 1, 1, 1, 1, 0, 1}, - {0, 1, 1, 1, 0, 1, 0, 1}, - {1, 1, 0, 1, 1, 1, 1, 1}, - {0, 0, 1, 0, 0, 1, 1, 1}, - {1, 1, 0, 0, 0, 0, 0, 1}, - {0, 1, 0, 0, 0, 0, 1, 1}, - {0, 1, 1, 1, 1, 0, 1, 0}}), - bm1({{0, 0, 0, 1, 0, 0, 1, 1}, - {0, 0, 1, 0, 0, 1, 0, 1}, - {1, 1, 0, 0, 1, 1, 0, 1}, - {1, 1, 0, 0, 0, 0, 0, 1}, - {0, 1, 0, 0, 0, 0, 1, 1}, - {0, 1, 0, 1, 1, 1, 1, 1}, - {0, 1, 0, 1, 0, 1, 0, 1}, - {0, 1, 0, 0, 0, 0, 1, 0}}), - bmm1({{1, 1, 0, 1, 0, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 0, 1, 1, 1, 1, 1}, - {0, 1, 1, 1, 0, 1, 1, 1}, - {0, 1, 1, 1, 0, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1}}), - bm2({{1, 1}, {0, 1}}), bm2t({{1, 0}, {1, 1}}), - bm3({{0, 0, 0, 1, 0, 0, 1, 1}, - {1, 1, 1, 1, 1, 1, 0, 1}, - {0, 1, 1, 1, 1, 1, 0, 1}, - {1, 1, 0, 1, 1, 1, 1, 1}, - {0, 0, 1, 0, 0, 1, 1, 1}, - {1, 1, 0, 0, 0, 0, 0, 1}, - {0, 1, 0, 0, 0, 0, 1, 1}, - {0, 1, 1, 1, 1, 0, 1, 0}}), - bm3t({{0, 1, 0, 1, 0, 1, 0, 0}, - {0, 1, 1, 1, 0, 1, 1, 1}, - {0, 1, 1, 0, 1, 0, 0, 1}, - {1, 1, 1, 1, 0, 0, 0, 1}, - {0, 1, 1, 1, 0, 0, 0, 1}, - {0, 1, 1, 1, 1, 0, 0, 0}, - {1, 0, 0, 1, 1, 0, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 0}}), - BMlist({zero, one1, one2, ones, bm, bm1, bmm1, bm2, bm2t, bm3, bm3t}) - { - BOOST_TEST_MESSAGE("setup fixture"); - } - ~Fix() { BOOST_TEST_MESSAGE("teardown fixture"); } +#include "bmat8.hpp" +#include "epu.hpp" +namespace HPCombi { +namespace { +struct BMat8Fixture { const BMat8 zero, one1, one2, ones, bm, bm1, bmm1, bm2, bm2t, bm3, bm3t; const std::vector BMlist; + BMat8Fixture() + : zero(0), one1(1), one2(0x201), ones(0xffffffffffffffff), + bm({{0, 0, 0, 1, 0, 0, 1, 1}, + {1, 1, 1, 1, 1, 1, 0, 1}, + {0, 1, 1, 1, 0, 1, 0, 1}, + {1, 1, 0, 1, 1, 1, 1, 1}, + {0, 0, 1, 0, 0, 1, 1, 1}, + {1, 1, 0, 0, 0, 0, 0, 1}, + {0, 1, 0, 0, 0, 0, 1, 1}, + {0, 1, 1, 1, 1, 0, 1, 0}}), + bm1({{0, 0, 0, 1, 0, 0, 1, 1}, + {0, 0, 1, 0, 0, 1, 0, 1}, + {1, 1, 0, 0, 1, 1, 0, 1}, + {1, 1, 0, 0, 0, 0, 0, 1}, + {0, 1, 0, 0, 0, 0, 1, 1}, + {0, 1, 0, 1, 1, 1, 1, 1}, + {0, 1, 0, 1, 0, 1, 0, 1}, + {0, 1, 0, 0, 0, 0, 1, 0}}), + bmm1({{1, 1, 0, 1, 0, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 0, 1, 1, 1, 1, 1}, + {0, 1, 1, 1, 0, 1, 1, 1}, + {0, 1, 1, 1, 0, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1}}), + bm2({{1, 1}, {0, 1}}), bm2t({{1, 0}, {1, 1}}), + bm3({{0, 0, 0, 1, 0, 0, 1, 1}, + {1, 1, 1, 1, 1, 1, 0, 1}, + {0, 1, 1, 1, 1, 1, 0, 1}, + {1, 1, 0, 1, 1, 1, 1, 1}, + {0, 0, 1, 0, 0, 1, 1, 1}, + {1, 1, 0, 0, 0, 0, 0, 1}, + {0, 1, 0, 0, 0, 0, 1, 1}, + {0, 1, 1, 1, 1, 0, 1, 0}}), + bm3t({{0, 1, 0, 1, 0, 1, 0, 0}, + {0, 1, 1, 1, 0, 1, 1, 1}, + {0, 1, 1, 0, 1, 0, 0, 1}, + {1, 1, 1, 1, 0, 0, 0, 1}, + {0, 1, 1, 1, 0, 0, 0, 1}, + {0, 1, 1, 1, 1, 0, 0, 0}, + {1, 0, 0, 1, 1, 0, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 0}}), + BMlist( + {zero, one1, one2, ones, bm, bm1, bmm1, bm2, bm2t, bm3, bm3t}) {} }; - +} // namespace //****************************************************************************// -BOOST_AUTO_TEST_SUITE(BMat8_test) //****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_one, Fix) { - BOOST_TEST(BMat8::one(0) == zero); - BOOST_TEST(BMat8::one(2) == BMat8( - {{1, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}})); - BOOST_TEST(BMat8::one(5) == BMat8( - {{1, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0}})); - BOOST_TEST(BMat8::one(8) == BMat8::one()); + +TEST_CASE_METHOD(BMat8Fixture, "BMat8::one", "[BMat8][000]") { + REQUIRE(BMat8::one(0) == zero); + REQUIRE(BMat8::one(2) == BMat8({{1, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}})); + REQUIRE(BMat8::one(5) == BMat8({{1, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}})); + REQUIRE(BMat8::one(8) == BMat8::one()); } -BOOST_FIXTURE_TEST_CASE(BMat8_transpose, Fix) { - BOOST_TEST(zero.transpose() == zero); - BOOST_TEST(bm2.transpose() == bm2t); - BOOST_TEST(bm3.transpose() == bm3t); +TEST_CASE_METHOD(BMat8Fixture, "BMat8::transpose", "[BMat8][001]") { + + REQUIRE(zero.transpose() == zero); + REQUIRE(bm2.transpose() == bm2t); + REQUIRE(bm3.transpose() == bm3t); - for (auto m : BMlist) - BOOST_TEST(m.transpose().transpose() == m); + for (auto m : BMlist) { + REQUIRE(m.transpose().transpose() == m); + } } -TEST_AGREES(BMat8, transpose, transpose_mask, BMlist); -TEST_AGREES(BMat8, transpose, transpose_maskd, BMlist); +TEST_AGREES(BMat8Fixture, BMat8, transpose, transpose_mask, BMlist, + "[BMat8][002]"); + +TEST_AGREES(BMat8Fixture, BMat8, transpose, transpose_maskd, BMlist, + "[BMat8][003]"); -BOOST_FIXTURE_TEST_CASE(BMat8_transpose2, Fix) { +TEST_CASE_METHOD(BMat8Fixture, "BMat8::transpose2", "[BMat8][004]") { for (auto a : BMlist) { for (auto b : BMlist) { BMat8 at = a, bt = b; BMat8::transpose2(at, bt); - BOOST_TEST(at == a.transpose()); - BOOST_TEST(bt == b.transpose()); + REQUIRE(at == a.transpose()); + REQUIRE(bt == b.transpose()); } } } -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_mult, Fix) { +TEST_CASE_METHOD(BMat8Fixture, "BMat8::operator*", "[BMat8][005]") { BMat8 tmp = bm * bm1; - BOOST_TEST(tmp == bmm1); - BOOST_TEST(tmp == bm * bm1); + REQUIRE(tmp == bmm1); + REQUIRE(tmp == bm * bm1); for (auto b : BMlist) { - BOOST_TEST(zero * b == zero); - BOOST_TEST(b * zero == zero); - BOOST_TEST(b * b.one() == b); - BOOST_TEST(b.one() * b == b); - BOOST_TEST((b * b) * (b * b) == b * b * b * b); + REQUIRE(zero * b == zero); + REQUIRE(b * zero == zero); + REQUIRE(b * b.one() == b); + REQUIRE(b.one() * b == b); + REQUIRE((b * b) * (b * b) == b * b * b * b); } - for (auto b1 : BMlist) - for (auto b2 : BMlist) - for (auto b3 : BMlist) - BOOST_TEST((b1 * b2) * b3 == b1 * (b2 * b3)); - + for (auto b1 : BMlist) { + for (auto b2 : BMlist) { + for (auto b3 : BMlist) { + REQUIRE((b1 * b2) * b3 == b1 * (b2 * b3)); + } + } + } } - -//****************************************************************************// -BOOST_AUTO_TEST_CASE(BMat8_random) { +TEST_CASE("BMat8::random", "[BMat8][006]") { for (size_t d = 1; d < 8; ++d) { BMat8 bm = BMat8::random(d); for (size_t i = d + 1; i < 8; ++i) { for (size_t j = 0; j < 8; ++j) { - BOOST_TEST(bm(i, j) == 0); - BOOST_TEST(bm(j, i) == 0); + REQUIRE(bm(i, j) == 0); + REQUIRE(bm(j, i) == 0); } } } } -//****************************************************************************// -BOOST_AUTO_TEST_CASE(BMat8_call_operator) { - std::vector> mat = {{0, 0, 0, 1, 0, 0, 1}, - {0, 1, 1, 1, 0, 1, 0}, - {1, 1, 0, 1, 1, 1, 1}, - {0, 0, 1, 0, 0, 1, 1}, - {1, 1, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 1}, - {0, 1, 1, 1, 1, 0, 1}}; - BMat8 bm(mat); - +TEST_CASE("BMat8::operator()", "[BMat8][007]") { + std::vector> mat = { + {0, 0, 0, 1, 0, 0, 1}, {0, 1, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 1, 1, 1}, + {0, 0, 1, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 1}, + {0, 1, 1, 1, 1, 0, 1}}; + BMat8 bm(mat); for (size_t i = 0; i < 7; ++i) { for (size_t j = 0; j < 7; ++j) { - BOOST_TEST(static_cast(bm(i, j)) == mat[i][j]); + REQUIRE(static_cast(bm(i, j)) == mat[i][j]); } } } -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_operator_insert, Fix) { +TEST_CASE_METHOD(BMat8Fixture, "BMat8::operator<<", "[BMat8][008]") { std::ostringstream oss; oss << bm3; - BOOST_TEST(oss.str() == - "00010011\n" - "11111101\n" - "01111101\n" - "11011111\n" - "00100111\n" - "11000001\n" - "01000011\n" - "01111010\n"); + REQUIRE(oss.str() == "00010011\n" + "11111101\n" + "01111101\n" + "11011111\n" + "00100111\n" + "11000001\n" + "01000011\n" + "01111010\n"); std::stringbuf buff; - std::ostream os(&buff); + std::ostream os(&buff); os << BMat8::random(); // Also does not do anything visible } -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_set, Fix) { +TEST_CASE_METHOD(BMat8Fixture, "BMat8::set", "[BMat8][009]") { BMat8 bs; - bs = bm; bs.set(0, 0, 1); - BOOST_TEST(bs != bm); - bs = bm; bs.set(0, 0, 0); - BOOST_TEST(bs == bm); - bs = bm; bs.set(2, 4, 1); - BOOST_TEST(bs != bm); - BOOST_TEST(bs == bm3); + bs = bm; + bs.set(0, 0, 1); + REQUIRE(bs != bm); + bs = bm; + bs.set(0, 0, 0); + REQUIRE(bs == bm); + bs = bm; + bs.set(2, 4, 1); + REQUIRE(bs != bm); + REQUIRE(bs == bm3); for (size_t i = 0; i < 8; ++i) - for (size_t j = 0; j < 8; ++j) - bs.set(i, j, true); - BOOST_TEST(bs == ones); + for (size_t j = 0; j < 8; ++j) + bs.set(i, j, true); + REQUIRE(bs == ones); for (size_t i = 0; i < 8; ++i) - for (size_t j = 0; j < 8; ++j) - bs.set(i, j, false); - BOOST_TEST(bs == zero); + for (size_t j = 0; j < 8; ++j) + bs.set(i, j, false); + REQUIRE(bs == zero); } -//****************************************************************************// -BOOST_AUTO_TEST_CASE(BMat8_row_space_basis) { +TEST_CASE("BMat8::row_space_basis", "[BMat8][010]") { BMat8 bm({{0, 1, 1, 1, 0, 1, 0, 1}, {0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 0, 1}, @@ -261,7 +235,7 @@ BOOST_AUTO_TEST_CASE(BMat8_row_space_basis) { {0, 0, 1, 0, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 1}}); - BOOST_TEST(bm.row_space_basis() == bm2.row_space_basis()); + REQUIRE(bm.row_space_basis() == bm2.row_space_basis()); BMat8 bm3({{1, 1, 1, 1, 0, 1, 0, 1}, {0, 1, 1, 1, 1, 1, 0, 1}, @@ -281,28 +255,25 @@ BOOST_AUTO_TEST_CASE(BMat8_row_space_basis) { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}}); - BOOST_TEST(bm3.row_space_basis() == bm4); - BOOST_TEST(bm4.row_space_basis() == bm4); + REQUIRE(bm3.row_space_basis() == bm4); + REQUIRE(bm4.row_space_basis() == bm4); BMat8 bm5(0xff00000000000000); uint64_t data = 0xffffffffffffffff; for (size_t i = 0; i < 7; ++i) { - BOOST_TEST(BMat8(data).row_space_basis() == bm5); + REQUIRE(BMat8(data).row_space_basis() == bm5); data = data >> 8; } for (size_t i = 0; i < 1000; ++i) { bm = BMat8::random(); - BOOST_TEST(bm.row_space_basis().row_space_basis() == bm.row_space_basis()); + REQUIRE(bm.row_space_basis().row_space_basis() == bm.row_space_basis()); } } - -//****************************************************************************// -//****************************************************************************// -BOOST_AUTO_TEST_CASE(BMat8_col_space_basis) { +TEST_CASE("BMat8::col_space_basis", "[BMat8][011]") { BMat8 bm({{0, 1, 1, 1, 0, 1, 0, 1}, {0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 0, 1}, @@ -321,7 +292,7 @@ BOOST_AUTO_TEST_CASE(BMat8_col_space_basis) { {1, 0, 1, 0, 0, 0, 0, 1}, {0, 0, 1, 1, 1, 0, 1, 1}}); - BOOST_TEST(bm.col_space_basis() == bm2); + REQUIRE(bm.col_space_basis() == bm2); BMat8 bm3({{1, 1, 1, 1, 0, 1, 0, 1}, {0, 1, 1, 1, 1, 1, 0, 1}, @@ -341,252 +312,242 @@ BOOST_AUTO_TEST_CASE(BMat8_col_space_basis) { {0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0}}); - BOOST_TEST(bm3.col_space_basis() == bm4); + REQUIRE(bm3.col_space_basis() == bm4); uint64_t col = 0x8080808080808080; - BMat8 bm5(col); + BMat8 bm5(col); uint64_t data = 0xffffffffffffffff; for (size_t i = 0; i < 7; ++i) { - BOOST_TEST(BMat8(data).col_space_basis() == bm5); + REQUIRE(BMat8(data).col_space_basis() == bm5); data &= ~(col >> i); } for (size_t i = 0; i < 1000; ++i) { bm = BMat8::random(); - BOOST_TEST(bm.col_space_basis().col_space_basis() == bm.col_space_basis()); + REQUIRE(bm.col_space_basis().col_space_basis() == bm.col_space_basis()); } } -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_row_space_size, Fix) { - BOOST_TEST(zero.row_space_size() == 1); - BOOST_TEST(one1.row_space_size() == 2); - BOOST_TEST(one2.row_space_size() == 4); - BOOST_TEST(BMat8::one().row_space_size() == 256); - BOOST_TEST(bm.row_space_size() == 22); - BOOST_TEST(bm1.row_space_size() == 31); - BOOST_TEST(bm2.row_space_size() == 3); - BOOST_TEST(bm2t.row_space_size() == 3); - BOOST_TEST(bm3.row_space_size() == 21); - BOOST_TEST(bm3t.row_space_size() == 21); - BOOST_TEST(bmm1.row_space_size() == 6); +TEST_CASE_METHOD(BMat8Fixture, "BMat8::row_space_size", "[BMat8][012]") { + REQUIRE(zero.row_space_size() == 1); + REQUIRE(one1.row_space_size() == 2); + REQUIRE(one2.row_space_size() == 4); + REQUIRE(BMat8::one().row_space_size() == 256); + REQUIRE(bm.row_space_size() == 22); + REQUIRE(bm1.row_space_size() == 31); + REQUIRE(bm2.row_space_size() == 3); + REQUIRE(bm2t.row_space_size() == 3); + REQUIRE(bm3.row_space_size() == 21); + REQUIRE(bm3t.row_space_size() == 21); + REQUIRE(bmm1.row_space_size() == 6); } -TEST_AGREES(BMat8, row_space_size_ref, row_space_size, BMlist); -TEST_AGREES(BMat8, row_space_size_ref, row_space_size_incl, BMlist); -TEST_AGREES(BMat8, row_space_size_ref, row_space_size_incl1, BMlist); -TEST_AGREES(BMat8, row_space_size_ref, row_space_size_bitset, BMlist); -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_row_space_included, Fix) { - BOOST_TEST(zero.row_space_included(one1)); - BOOST_TEST(not one1.row_space_included(zero)); +TEST_AGREES(BMat8Fixture, BMat8, row_space_size_ref, row_space_size, BMlist, + "[BMat8][013]"); +TEST_AGREES(BMat8Fixture, BMat8, row_space_size_ref, row_space_size_incl, + BMlist, "[BMat8][014]"); +TEST_AGREES(BMat8Fixture, BMat8, row_space_size_ref, row_space_size_incl1, + BMlist, "[BMat8][015]"); +TEST_AGREES(BMat8Fixture, BMat8, row_space_size_ref, row_space_size_bitset, + BMlist, "[BMat8][016]"); + +TEST_CASE_METHOD(BMat8Fixture, "BMat8::row_space_included", "[BMat8][017]") { + REQUIRE(zero.row_space_included(one1)); + REQUIRE_FALSE(one1.row_space_included(zero)); BMat8 m1({{1, 1, 0}, {1, 0, 1}, {0, 0, 0}}); BMat8 m2({{0, 0, 0}, {1, 0, 1}, {1, 1, 0}}); - BOOST_TEST(m1.row_space_included(m2)); - BOOST_TEST(m2.row_space_included(m1)); + REQUIRE(m1.row_space_included(m2)); + REQUIRE(m2.row_space_included(m1)); BMat8 m3({{0, 0, 1}, {1, 0, 1}, {1, 1, 0}}); - BOOST_TEST(m1.row_space_included(m3)); - BOOST_TEST(m2.row_space_included(m3)); - BOOST_TEST(not m3.row_space_included(m1)); - BOOST_TEST(not m3.row_space_included(m1)); - - BOOST_TEST(m1.row_space_included(BMat8::one())); - BOOST_TEST(m2.row_space_included(BMat8::one())); - BOOST_TEST(m3.row_space_included(BMat8::one())); - + REQUIRE(m1.row_space_included(m3)); + REQUIRE(m2.row_space_included(m3)); + REQUIRE_FALSE(m3.row_space_included(m1)); + REQUIRE_FALSE(m3.row_space_included(m1)); + + REQUIRE(m1.row_space_included(BMat8::one())); + REQUIRE(m2.row_space_included(BMat8::one())); + REQUIRE(m3.row_space_included(BMat8::one())); } -TEST_AGREES2(BMat8, row_space_included, row_space_included_ref, BMlist); -TEST_AGREES2(BMat8, row_space_included, row_space_included_bitset, BMlist); -BOOST_FIXTURE_TEST_CASE(BMat8_row_space_included2, Fix) { - BMat8 a0 = BMat8::one(); BMat8 b0 = BMat8(0); - BMat8 a1 = BMat8(0); BMat8 b1 = BMat8::one(); +TEST_AGREES2(BMat8Fixture, BMat8, row_space_included, row_space_included_ref, + BMlist, "[BMat8][018]"); +TEST_AGREES2(BMat8Fixture, BMat8, row_space_included, row_space_included_bitset, + BMlist, "[BMat8][019]"); + +TEST_CASE_METHOD(BMat8Fixture, "BMat8::row_space_included2", "[BMat8][020]") { + BMat8 a0 = BMat8::one(); + BMat8 b0 = BMat8(0); + BMat8 a1 = BMat8(0); + BMat8 b1 = BMat8::one(); auto res = BMat8::row_space_included2(a0, b0, a1, b1); - BOOST_TEST(res.first == a0.row_space_included(b0)); - BOOST_TEST(res.second == a1.row_space_included(b1)); + REQUIRE(res.first == a0.row_space_included(b0)); + REQUIRE(res.second == a1.row_space_included(b1)); for (auto a0 : BMlist) { for (auto b0 : BMlist) { for (auto a1 : BMlist) { for (auto b1 : BMlist) { auto res = BMat8::row_space_included2(a0, b0, a1, b1); - BOOST_TEST(res.first == a0.row_space_included(b0)); - BOOST_TEST(res.second == a1.row_space_included(b1)); + REQUIRE(res.first == a0.row_space_included(b0)); + REQUIRE(res.second == a1.row_space_included(b1)); } } } } } - -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_row_permuted, Fix) { - BOOST_TEST(bm2.row_permuted(Perm16({1,0})) == - BMat8({{0,1},{1,1}})); - BOOST_TEST(bm2.row_permuted(Perm16({2,1,0})) == - BMat8({{0,0,0},{0,1,0},{1,1,0}})); - BOOST_TEST(bm.row_permuted(Perm16({5,3,1,4,2,0})) == - BMat8({{1, 1, 0, 0, 0, 0, 0, 1}, - {1, 1, 0, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 0, 1}, - {0, 0, 1, 0, 0, 1, 1, 1}, - {0, 1, 1, 1, 0, 1, 0, 1}, - {0, 0, 0, 1, 0, 0, 1, 1}, - {0, 1, 0, 0, 0, 0, 1, 1}, - {0, 1, 1, 1, 1, 0, 1, 0}})); - BOOST_TEST(BMat8::one().row_permuted(Perm16({5,3,1,4,2,0})) == - BMat8({{0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); +TEST_CASE_METHOD(BMat8Fixture, "BMat8::row_permuted", "[BMat8][021]") { + REQUIRE(bm2.row_permuted(Perm16({1, 0})) == BMat8({{0, 1}, {1, 1}})); + REQUIRE(bm2.row_permuted(Perm16({2, 1, 0})) == + BMat8({{0, 0, 0}, {0, 1, 0}, {1, 1, 0}})); + REQUIRE(bm.row_permuted(Perm16({5, 3, 1, 4, 2, 0})) == + BMat8({{1, 1, 0, 0, 0, 0, 0, 1}, + {1, 1, 0, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 0, 1}, + {0, 0, 1, 0, 0, 1, 1, 1}, + {0, 1, 1, 1, 0, 1, 0, 1}, + {0, 0, 0, 1, 0, 0, 1, 1}, + {0, 1, 0, 0, 0, 0, 1, 1}, + {0, 1, 1, 1, 1, 0, 1, 0}})); + REQUIRE(BMat8::one().row_permuted(Perm16({5, 3, 1, 4, 2, 0})) == + BMat8({{0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); } -BOOST_FIXTURE_TEST_CASE(BMat8_col_permuted, Fix) { - BOOST_TEST(bm2.col_permuted(Perm16({1,0})) == - BMat8({{1,1},{1,0}})); - BOOST_TEST(bm2.col_permuted(Perm16({2,1,0})) == - BMat8({{0,1,1},{0,1,0},{0,0,0}})); - BOOST_TEST(bm.col_permuted( - Perm16({5, 3, 1, 4, 2, 0})) == - BMat8( {{0, 1, 0, 0, 0, 0, 1, 1}, - {1, 1, 1, 1, 1, 1, 0, 1}, - {1, 1, 1, 0, 1, 0, 0, 1}, - {1, 1, 1, 1, 0, 1, 1, 1}, - {1, 0, 0, 0, 1, 0, 1, 1}, - {0, 0, 1, 0, 0, 1, 0, 1}, - {0, 0, 1, 0, 0, 0, 1, 1}, - {0, 1, 1, 1, 1, 0, 1, 0}})); - BOOST_TEST(BMat8::one().col_permuted( - Perm16({4, 1, 3, 0, 2, 6, 5})) == - BMat8({ {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); +TEST_CASE_METHOD(BMat8Fixture, "BMat8::col_permuted", "[BMat8][022]") { + REQUIRE(bm2.col_permuted(Perm16({1, 0})) == BMat8({{1, 1}, {1, 0}})); + REQUIRE(bm2.col_permuted(Perm16({2, 1, 0})) == + BMat8({{0, 1, 1}, {0, 1, 0}, {0, 0, 0}})); + REQUIRE(bm.col_permuted(Perm16({5, 3, 1, 4, 2, 0})) == + BMat8({{0, 1, 0, 0, 0, 0, 1, 1}, + {1, 1, 1, 1, 1, 1, 0, 1}, + {1, 1, 1, 0, 1, 0, 0, 1}, + {1, 1, 1, 1, 0, 1, 1, 1}, + {1, 0, 0, 0, 1, 0, 1, 1}, + {0, 0, 1, 0, 0, 1, 0, 1}, + {0, 0, 1, 0, 0, 0, 1, 1}, + {0, 1, 1, 1, 1, 0, 1, 0}})); + REQUIRE(BMat8::one().col_permuted(Perm16({4, 1, 3, 0, 2, 6, 5})) == + BMat8({{0, 0, 0, 1, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); } -BOOST_FIXTURE_TEST_CASE(BMat8_row_permutation_matrix, Fix) { - BOOST_TEST(BMat8::row_permutation_matrix( - Perm16({1, 0})) == - BMat8({ {0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); - BOOST_TEST(BMat8::row_permutation_matrix( - Perm16({1, 3, 4, 0, 2})) == - BMat8({ {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); - BOOST_TEST(BMat8::row_permutation_matrix( - Perm16({5, 3, 1, 4, 2, 0})) == - BMat8({ {0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); +TEST_CASE("BMat8::row_permutation_matrix", "[BMat8][023]") { + REQUIRE(BMat8::row_permutation_matrix(Perm16({1, 0})) == + BMat8({{0, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); + REQUIRE(BMat8::row_permutation_matrix(Perm16({1, 3, 4, 0, 2})) == + BMat8({{0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); + REQUIRE(BMat8::row_permutation_matrix(Perm16({5, 3, 1, 4, 2, 0})) == + BMat8({{0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); } -BOOST_FIXTURE_TEST_CASE(BMat8_col_permutation_matrix, Fix) { - BOOST_TEST(BMat8::col_permutation_matrix( - Perm16({1, 0})) == - BMat8({ {0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); - BOOST_TEST(BMat8::col_permutation_matrix( - Perm16({1, 3, 4, 0, 2})) == - BMat8({ {0, 0, 0, 1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); - BOOST_TEST(BMat8::col_permutation_matrix( - Perm16({5, 3, 1, 4, 2, 0})) == - BMat8({ {0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}})); +TEST_CASE("BMat8::col_permutation_matrix", "[BMat8][024]") { + REQUIRE(BMat8::col_permutation_matrix(Perm16({1, 0})) == + BMat8({{0, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); + REQUIRE(BMat8::col_permutation_matrix(Perm16({1, 3, 4, 0, 2})) == + BMat8({{0, 0, 0, 1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); + REQUIRE(BMat8::col_permutation_matrix(Perm16({5, 3, 1, 4, 2, 0})) == + BMat8({{0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}})); } -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_nr_rows, Fix) { - BOOST_TEST(zero.nr_rows() == 0); - BOOST_TEST(one1.nr_rows() == 1); - BOOST_TEST(one2.nr_rows() == 2); - BOOST_TEST(bm.nr_rows() == 8); - BOOST_TEST(BMat8({{1, 0, 1}, - {1, 1, 0}, - {0, 0, 0}}).nr_rows() == 2); +TEST_CASE_METHOD(BMat8Fixture, "BMat8::nr_rows", "[BMat8][025]") { + REQUIRE(zero.nr_rows() == 0); + REQUIRE(one1.nr_rows() == 1); + REQUIRE(one2.nr_rows() == 2); + REQUIRE(bm.nr_rows() == 8); + REQUIRE(BMat8({{1, 0, 1}, {1, 1, 0}, {0, 0, 0}}).nr_rows() == 2); } -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(BMat8_right_perm_action_on_basis_ref, Fix) { - BMat8 m1({{1, 1, 0}, {1, 0, 1}, {0, 0, 0}}); - BMat8 m2({{0, 0, 0}, {1, 0, 1}, {1, 1, 0}}); - BOOST_TEST(m1.right_perm_action_on_basis_ref(m2) == Perm16({1,0})); - BOOST_TEST(m1.right_perm_action_on_basis(m2) == Perm16({1,0})); - - m1 = BMat8({{1, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}, {0, 0, 0, 0}}); - m2 = BMat8({{1, 0, 0, 0}, {0, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}}); - BOOST_TEST(m1.right_perm_action_on_basis_ref(m2) == Perm16::one()); - BOOST_TEST(m1.right_perm_action_on_basis(m2) == Perm16::one()); - - m1 = BMat8({{1, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}, {0, 0, 0, 0}}); - m2 = BMat8({{0, 0, 0, 0}, {1, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}}); - BOOST_TEST(m1.right_perm_action_on_basis_ref(m2) == Perm16::one()); - BOOST_TEST(m1.right_perm_action_on_basis(m2) == Perm16::one()); - - m1 = BMat8({{0,1,0,0}, {0,0,1,0}, {1,0,0,1}, {0,0,0,0}}); - m2 = BMat8({{1,0,0,1}, {0,0,1,0}, {0,1,0,0}, {0,0,0,1}}); - BOOST_TEST(m1.right_perm_action_on_basis_ref(m2) == Perm16({1,0})); - BOOST_TEST(m1.right_perm_action_on_basis(m2) == Perm16({1,0})); - - m1 = BMat8({{0,0,0,1}, {1,0,0,0}, {0,0,1,0}, {0,1,0,0}}); - m2 = BMat8({{0,1,0,0}, {0,0,1,0}, {1,0,0,0}, {0,0,0,1}}); - BOOST_TEST(m1.right_perm_action_on_basis_ref(m2) == Perm16({0,2,3,1})); - BOOST_TEST(m1.right_perm_action_on_basis(m2) == Perm16({0,2,3,1})); - - - m1 = BMat8({{0,0,0,1}, {0,0,1,0}, {0,1,0,0}, {1,0,0,0}}); - m2 = BMat8({{0,1,0,0}, {0,0,0,1}, {1,0,0,0}, {0,0,1,0}}); - BOOST_TEST(m1.right_perm_action_on_basis_ref(m2) == Perm16({2,0,3,1})); - BOOST_TEST(m1.right_perm_action_on_basis(m2) == Perm16({2,0,3,1})); -} -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// +// TEST_CASE("BMat8::right_perm_action_on_basis_ref", "[BMat8][026]") { +// BMat8 m1({{1, 1, 0}, {1, 0, 1}, {0, 0, 0}}); +// BMat8 m2({{0, 0, 0}, {1, 0, 1}, {1, 1, 0}}); +// REQUIRE(m1.right_perm_action_on_basis_ref(m2) == Perm16({1,0})); +// REQUIRE(m1.right_perm_action_on_basis(m2) == Perm16({1,0})); +// +// m1 = BMat8({{1, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}, {0, 0, 0, 0}}); +// m2 = BMat8({{1, 0, 0, 0}, {0, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}}); +// REQUIRE(m1.right_perm_action_on_basis_ref(m2) == Perm16::one()); +// REQUIRE(m1.right_perm_action_on_basis(m2) == Perm16::one()); +// +// m1 = BMat8({{1, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}, {0, 0, 0, 0}}); +// m2 = BMat8({{0, 0, 0, 0}, {1, 1, 0, 1}, {1, 0, 1, 0}, {0, 0, 0, 1}}); +// REQUIRE(m1.right_perm_action_on_basis_ref(m2) == Perm16::one()); +// REQUIRE(m1.right_perm_action_on_basis(m2) == Perm16::one()); +// +// m1 = BMat8({{0,1,0,0}, {0,0,1,0}, {1,0,0,1}, {0,0,0,0}}); +// m2 = BMat8({{1,0,0,1}, {0,0,1,0}, {0,1,0,0}, {0,0,0,1}}); +// REQUIRE(m1.right_perm_action_on_basis_ref(m2) == Perm16({1,0})); +// REQUIRE(m1.right_perm_action_on_basis(m2) == Perm16({1,0})); +// +// m1 = BMat8({{0,0,0,1}, {1,0,0,0}, {0,0,1,0}, {0,1,0,0}}); +// m2 = BMat8({{0,1,0,0}, {0,0,1,0}, {1,0,0,0}, {0,0,0,1}}); +// REQUIRE(m1.right_perm_action_on_basis_ref(m2) == Perm16({0,2,3,1})); +// REQUIRE(m1.right_perm_action_on_basis(m2) == Perm16({0,2,3,1})); +// +// +// m1 = BMat8({{0,0,0,1}, {0,0,1,0}, {0,1,0,0}, {1,0,0,0}}); +// m2 = BMat8({{0,1,0,0}, {0,0,0,1}, {1,0,0,0}, {0,0,1,0}}); +// REQUIRE(m1.right_perm_action_on_basis_ref(m2) == Perm16({2,0,3,1})); +// REQUIRE(m1.right_perm_action_on_basis(m2) == Perm16({2,0,3,1})); +// } + +} // namespace HPCombi diff --git a/tests/test_epu.cpp b/tests/test_epu.cpp index adef614a..5eb5e5e0 100644 --- a/tests/test_epu.cpp +++ b/tests/test_epu.cpp @@ -13,769 +13,706 @@ /* http://www.gnu.org/licenses/ */ /******************************************************************************/ -#define BOOST_TEST_MODULE EPUTests - -#include -#include +#include #include #include "epu.hpp" -#include -using namespace HPCombi; +#include "test_main.hpp" +#include -#define EPU8_EQUAL(p1, p2) BOOST_CHECK_PREDICATE(equal, (p1)(p2)) -#define EPU8_NOT_EQUAL(p1, p2) BOOST_CHECK_PREDICATE(boost::not2(equal), (p1)(p2)) - -#define TEST_AGREES(ref, fun) \ - BOOST_FIXTURE_TEST_CASE(EPU8_agrees_##fun, Fix) { \ - for (auto x : v) BOOST_TEST(fun(x) == ref(x)); \ - } -#define TEST_EPU8_AGREES(ref, fun) \ - BOOST_FIXTURE_TEST_CASE(EPU8_agrees_##fun, Fix) { \ - for (auto x : v) EPU8_EQUAL(fun(x), ref(x)); \ - } +// #define TEST_AGREES(ref, fun) \ +// BOOST_FIXTURE_TEST_CASE(Epu8::agrees_##fun, Fix) { \ +// for (auto x : v) \ +// REQUIRE(fun(x) == ref(x)); \ +// } +namespace HPCombi { struct Fix { - Fix() : zero(Epu8({}, 0)), P01(Epu8({0, 1}, 0)), - P10(Epu8({1, 0}, 0)), P11(Epu8({1, 1}, 0)), - P1(Epu8({}, 1)), - P112(Epu8({1, 1}, 2)), - Pa(epu8{1, 2, 3, 4, 0, 5, 6, 7, 8, 9,10,11,12,13,14,15}), - Pb(epu8{1, 2, 3, 6, 0, 5, 4, 7, 8, 9,10,11,12,15,14,13}), - RP(epu8{ 3, 1, 0,14,15,13, 5,10, 2,11, 6,12, 7, 4, 8, 9}), - Pa1(Epu8({4, 2, 5, 1, 2, 7, 7, 3, 4, 2}, 1)), - Pa2(Epu8({4, 2, 5, 1, 2, 9, 7, 3, 4, 2}, 1)), - P51(Epu8({5,1}, 6)), - Pv(epu8{ 5, 5, 2, 5, 1, 6,12, 4, 0, 3, 2,11,12,13,14,15}), - Pw(epu8{ 5, 5, 2, 9, 1, 6,12, 4, 0, 4, 4, 4,12,13,14,15}), - P5(Epu8({}, 5)), - Pc(Epu8({23, 5, 21, 5, 43, 36}, 7)), - // Elements should be sorted in alphabetic order here - v({zero, P01, epu8id, P10, P11, P1, P112, Pa, Pb, RP, - Pa1, Pa2, P51, Pv, Pw, P5, epu8rev, Pc}), - av({{ 5, 5, 2, 5, 1, 6,12, 4, 0, 3, 2,11,12,13,14,15}}) - { - BOOST_TEST_MESSAGE("setup fixture"); - } - ~Fix() { BOOST_TEST_MESSAGE("teardown fixture"); } - - const epu8 zero, P01, P10, P11, P1, P112, Pa, Pb, RP, - Pa1, Pa2, P51, Pv, Pw, P5, Pc; + Fix() + : zero(Epu8({}, 0)), P01(Epu8({0, 1}, 0)), P10(Epu8({1, 0}, 0)), + P11(Epu8({1, 1}, 0)), P1(Epu8({}, 1)), P112(Epu8({1, 1}, 2)), + Pa(epu8{1, 2, 3, 4, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), + Pb(epu8{1, 2, 3, 6, 0, 5, 4, 7, 8, 9, 10, 11, 12, 15, 14, 13}), + RP(epu8{3, 1, 0, 14, 15, 13, 5, 10, 2, 11, 6, 12, 7, 4, 8, 9}), + Pa1(Epu8({4, 2, 5, 1, 2, 7, 7, 3, 4, 2}, 1)), + Pa2(Epu8({4, 2, 5, 1, 2, 9, 7, 3, 4, 2}, 1)), P51(Epu8({5, 1}, 6)), + Pv(epu8{5, 5, 2, 5, 1, 6, 12, 4, 0, 3, 2, 11, 12, 13, 14, 15}), + Pw(epu8{5, 5, 2, 9, 1, 6, 12, 4, 0, 4, 4, 4, 12, 13, 14, 15}), + P5(Epu8({}, 5)), Pc(Epu8({23, 5, 21, 5, 43, 36}, 7)), + // Elements should be sorted in alphabetic order here + v({zero, P01, epu8id, P10, P11, P1, P112, Pa, Pb, RP, Pa1, Pa2, P51, + Pv, Pw, P5, epu8rev, Pc}), + av({{5, 5, 2, 5, 1, 6, 12, 4, 0, 3, 2, 11, 12, 13, 14, 15}}) {} + ~Fix() = default; + + const epu8 zero, P01, P10, P11, P1, P112, Pa, Pb, RP, Pa1, Pa2, P51, Pv, Pw, + P5, Pc; const std::vector v; const std::array av; }; - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_compare) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_first_diff_ref, Fix) { - BOOST_TEST(first_diff_ref(Pc, Pc) == 16); - BOOST_TEST(first_diff_ref(zero, P01) == 1); - BOOST_TEST(first_diff_ref(zero, P10) == 0); - BOOST_TEST(first_diff_ref(zero, P01, 1) == 16); - BOOST_TEST(first_diff_ref(zero, P01, 2) == 1); - BOOST_TEST(first_diff_ref(Pa1, Pa2, 2) == 16); - BOOST_TEST(first_diff_ref(Pa1, Pa2, 4) == 16); - BOOST_TEST(first_diff_ref(Pa1, Pa2, 5) == 16); - BOOST_TEST(first_diff_ref(Pa1, Pa2, 6) == 5); - BOOST_TEST(first_diff_ref(Pa1, Pa2, 7) == 5); - BOOST_TEST(first_diff_ref(Pa1, Pa2) == 5); - BOOST_TEST(first_diff(Pv, Pw) == 3); - for (int i=0; i<16; i++) - BOOST_TEST(first_diff(Pv, Pw, i) == (i <= 3 ? 16 : 3)); -} -BOOST_FIXTURE_TEST_CASE(EPU8_first_diff_cmpstr, Fix) { +TEST_CASE_METHOD(Fix, "Epu8::first_diff_ref", "[Epu8][000]") { + REQUIRE(first_diff_ref(Pc, Pc) == 16); + REQUIRE(first_diff_ref(zero, P01) == 1); + REQUIRE(first_diff_ref(zero, P10) == 0); + REQUIRE(first_diff_ref(zero, P01, 1) == 16); + REQUIRE(first_diff_ref(zero, P01, 2) == 1); + REQUIRE(first_diff_ref(Pa1, Pa2, 2) == 16); + REQUIRE(first_diff_ref(Pa1, Pa2, 4) == 16); + REQUIRE(first_diff_ref(Pa1, Pa2, 5) == 16); + REQUIRE(first_diff_ref(Pa1, Pa2, 6) == 5); + REQUIRE(first_diff_ref(Pa1, Pa2, 7) == 5); + REQUIRE(first_diff_ref(Pa1, Pa2) == 5); + REQUIRE(first_diff(Pv, Pw) == 3); + for (int i = 0; i < 16; i++) + REQUIRE(first_diff(Pv, Pw, i) == (i <= 3 ? 16 : 3)); +} + +#ifdef SIMDE_X86_SSE4_2_NATIVE +TEST_CASE_METHOD(Fix, "Epu8::first_diff_cmpstr", "[Epu8][001]") { for (auto x : v) { for (auto y : v) { - BOOST_TEST(first_diff_cmpstr(x, y) == first_diff_ref(x, y)); - for (int i=0; i<17; i++) - BOOST_TEST(first_diff_cmpstr(x, y, i) == first_diff_ref(x, y, i)); + REQUIRE(first_diff_cmpstr(x, y) == first_diff_ref(x, y)); + for (int i = 0; i < 17; i++) + REQUIRE(first_diff_cmpstr(x, y, i) == first_diff_ref(x, y, i)); } } } -BOOST_FIXTURE_TEST_CASE(EPU8_first_diff_mask, Fix) { +#endif +TEST_CASE_METHOD(Fix, "Epu8::first_diff_mask", "[Epu8][002]") { for (auto x : v) { for (auto y : v) { - BOOST_TEST(first_diff_mask(x, y) == first_diff_ref(x, y)); - for (int i=0; i<17; i++) - BOOST_TEST(first_diff_mask(x, y, i) == first_diff_ref(x, y, i)); + REQUIRE(first_diff_mask(x, y) == first_diff_ref(x, y)); + for (int i = 0; i < 17; i++) + REQUIRE(first_diff_mask(x, y, i) == first_diff_ref(x, y, i)); } } } -BOOST_FIXTURE_TEST_CASE(EPU8_last_diff_ref, Fix) { - BOOST_TEST(last_diff_ref(Pc, Pc) == 16); - BOOST_TEST(last_diff_ref(zero, P01) == 1); - BOOST_TEST(last_diff_ref(zero, P10) == 0); - BOOST_TEST(last_diff_ref(zero, P01, 1) == 16); - BOOST_TEST(last_diff_ref(zero, P01, 2) == 1); - BOOST_TEST(last_diff_ref(P1, Pa1) == 9); - BOOST_TEST(last_diff_ref(P1, Pa1, 12) == 9); - BOOST_TEST(last_diff_ref(P1, Pa1, 9) == 8); - BOOST_TEST(last_diff_ref(Pa1, Pa2, 2) == 16); - BOOST_TEST(last_diff_ref(Pa1, Pa2, 4) == 16); - BOOST_TEST(last_diff_ref(Pa1, Pa2, 5) == 16); - BOOST_TEST(last_diff_ref(Pa1, Pa2, 6) == 5); - BOOST_TEST(last_diff_ref(Pa1, Pa2, 7) == 5); - BOOST_TEST(last_diff_ref(Pa1, Pa2) == 5); - const std::array res {{ - 16,16,16,16, 3, 3, 3, 3, 3, 3,9,10,11,11,11,11,11 - }}; - for (int i=0; i<=16; i++) - BOOST_TEST(last_diff_ref(Pv, Pw, i) == res[i]); -} -BOOST_FIXTURE_TEST_CASE(EPU8_last_diff_cmpstr, Fix) { +TEST_CASE_METHOD(Fix, "Epu8::last_diff_ref", "[Epu8][003]") { + REQUIRE(last_diff_ref(Pc, Pc) == 16); + REQUIRE(last_diff_ref(zero, P01) == 1); + REQUIRE(last_diff_ref(zero, P10) == 0); + REQUIRE(last_diff_ref(zero, P01, 1) == 16); + REQUIRE(last_diff_ref(zero, P01, 2) == 1); + REQUIRE(last_diff_ref(P1, Pa1) == 9); + REQUIRE(last_diff_ref(P1, Pa1, 12) == 9); + REQUIRE(last_diff_ref(P1, Pa1, 9) == 8); + REQUIRE(last_diff_ref(Pa1, Pa2, 2) == 16); + REQUIRE(last_diff_ref(Pa1, Pa2, 4) == 16); + REQUIRE(last_diff_ref(Pa1, Pa2, 5) == 16); + REQUIRE(last_diff_ref(Pa1, Pa2, 6) == 5); + REQUIRE(last_diff_ref(Pa1, Pa2, 7) == 5); + REQUIRE(last_diff_ref(Pa1, Pa2) == 5); + const std::array res{ + {16, 16, 16, 16, 3, 3, 3, 3, 3, 3, 9, 10, 11, 11, 11, 11, 11}}; + for (int i = 0; i <= 16; i++) { + REQUIRE(last_diff_ref(Pv, Pw, i) == res[i]); + } +} +#ifdef SIMDE_X86_SSE4_2_NATIVE +TEST_CASE_METHOD(Fix, "Epu8::last_diff_cmpstr", "[Epu8][004]") { for (auto x : v) { for (auto y : v) { - BOOST_TEST(last_diff_cmpstr(x, y) == last_diff_ref(x, y)); - for (int i=0; i<17; i++) - BOOST_TEST(last_diff_cmpstr(x, y, i) == last_diff_ref(x, y, i)); + REQUIRE(last_diff_cmpstr(x, y) == last_diff_ref(x, y)); + for (int i = 0; i < 17; i++) + REQUIRE(last_diff_cmpstr(x, y, i) == last_diff_ref(x, y, i)); } } } -BOOST_FIXTURE_TEST_CASE(EPU8_last_diff_mask, Fix) { +#endif + +TEST_CASE_METHOD(Fix, "Epu8::last_diff_mask", "[Epu8][005]") { for (auto x : v) { for (auto y : v) { - BOOST_TEST(last_diff_mask(x, y) == last_diff_ref(x, y)); - for (int i=0; i<17; i++) - BOOST_TEST(last_diff_mask(x, y, i) == last_diff_ref(x, y, i)); + REQUIRE(last_diff_mask(x, y) == last_diff_ref(x, y)); + for (int i = 0; i < 17; i++) + REQUIRE(last_diff_mask(x, y, i) == last_diff_ref(x, y, i)); } } } - -BOOST_FIXTURE_TEST_CASE(EPU8_is_all_zero, Fix) { - BOOST_TEST(is_all_zero(zero)); +TEST_CASE_METHOD(Fix, "Epu8::is_all_zero", "[Epu8][006]") { + REQUIRE(is_all_zero(zero)); for (size_t i = 1; i < v.size(); i++) { - BOOST_TEST(not is_all_zero(v[i])); + REQUIRE(!is_all_zero(v[i])); } } -BOOST_FIXTURE_TEST_CASE(EPU8_is_all_one, Fix) { +TEST_CASE_METHOD(Fix, "Epu8::is_all_one", "[Epu8][007]") { for (size_t i = 0; i < v.size(); i++) { - BOOST_TEST(not is_all_one(v[i])); + REQUIRE(!is_all_one(v[i])); } - BOOST_TEST(is_all_one(Epu8(0xFF))); + REQUIRE(is_all_one(Epu8(0xFF))); } -BOOST_FIXTURE_TEST_CASE(EPU8_equal, Fix) { +TEST_CASE_METHOD(Fix, "Epu8::equal", "[Epu8][008]") { for (size_t i = 0; i < v.size(); i++) { epu8 a = v[i]; for (size_t j = 0; j < v.size(); j++) { epu8 b = v[j]; if (i == j) { - BOOST_CHECK_PREDICATE(equal, (a)(b)); - BOOST_CHECK_PREDICATE(boost::not2(not_equal), (a)(b)); - BOOST_CHECK_PREDICATE(std::equal_to(), (a)(b)); -// For some reason, the following line doesn't compile -// BOOST_CHECK_PREDICATE(boost::not2(std::not_equal_to()), -// (a)(b)); - BOOST_CHECK_PREDICATE( - [](epu8 a, epu8 b) { - return not std::not_equal_to()(a, b); - }, (a)(b)); + REQUIRE(equal(a, b)); + REQUIRE(!not_equal(a, b)); + REQUIRE(std::equal_to()(a, b)); + REQUIRE(!std::not_equal_to()(a, b)); } else { - BOOST_CHECK_PREDICATE(boost::not2(equal), (a)(b)); - BOOST_CHECK_PREDICATE(not_equal, (a)(b)); - BOOST_CHECK_PREDICATE(std::not_equal_to(), (a)(b)); -// For some reason, the following line doesn't compile -// BOOST_CHECK_PREDICATE(boost::not2(std::equal_to()), (a)(b)); - BOOST_CHECK_PREDICATE( - [](epu8 a, epu8 b) { - return not std::equal_to()(a, b); - }, (a)(b)); + REQUIRE(!equal(a, b)); + REQUIRE(not_equal(a, b)); + REQUIRE(std::not_equal_to()(a, b)); + REQUIRE(!std::equal_to()(a, b)); } } } } -BOOST_FIXTURE_TEST_CASE(EPU8_not_equal, Fix) { - for (size_t i = 0; i < v.size(); i++) - for (size_t j = 0; j < v.size(); j++) - if (i == j) - BOOST_CHECK_PREDICATE(boost::not2(not_equal), - (v[i])(v[j])); - else - BOOST_CHECK_PREDICATE(not_equal, (v[i])(v[j])); +TEST_CASE_METHOD(Fix, "Epu8::not_equal", "[Epu8][009]") { + for (size_t i = 0; i < v.size(); i++) { + for (size_t j = 0; j < v.size(); j++) { + if (i == j) { + REQUIRE(!not_equal(v[i], v[j])); + } else { + REQUIRE(not_equal(v[i], v[j])); + } + } + } } -BOOST_FIXTURE_TEST_CASE(EPU8_less, Fix) { - for (size_t i = 0; i < v.size(); i++) - for (size_t j = 0; j < v.size(); j++) - if (i < j) - BOOST_CHECK_PREDICATE(less, (v[i])(v[j])); - else - BOOST_CHECK_PREDICATE(boost::not2(less), (v[i])(v[j])); +TEST_CASE_METHOD(Fix, "Epu8::less", "[Epu8][010]") { + for (size_t i = 0; i < v.size(); i++) { + for (size_t j = 0; j < v.size(); j++) { + if (i < j) { + REQUIRE(less(v[i], v[j])); + } else { + REQUIRE(!less(v[i], v[j])); + } + } + } } -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_permute) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_permuted, Fix) { - EPU8_EQUAL(permuted(epu8{ 0, 1, 3, 2, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15}, - epu8{ 3, 2, 5, 1, 4, 0, 6, 7, 8, 9,10,11,12,13,14,15}), - (epu8 { 2, 3, 5, 1, 4, 0, 6, 7, 8, 9,10,11,12,13,14,15})); - EPU8_EQUAL(permuted(epu8{ 3, 2, 5, 1, 4, 0, 6, 7, 8, 9,10,11,12,13,14,15}, - epu8{ 0, 1, 3, 2, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15}), - (epu8 { 3, 2, 1, 5, 4, 0, 6, 7, 8, 9,10,11,12,13,14,15})); - EPU8_EQUAL(permuted(epu8{ 3, 2, 5, 1, 4, 0, 6, 7, 8, 9,10,11,12,13,14,15}, - epu8{ 2, 2, 1, 2, 3, 6,12, 4, 5,16,17,11,12,13,14,15}), - (epu8 { 5, 5, 2, 5, 1, 6,12, 4, 0, 3, 2,11,12,13,14,15})); +TEST_CASE_METHOD(Fix, "Epu8::permuted", "[Epu8][011]") { + REQUIRE(equal( + permuted(epu8{0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + epu8{3, 2, 5, 1, 4, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), + epu8{2, 3, 5, 1, 4, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15})); + REQUIRE(equal( + permuted(epu8{3, 2, 5, 1, 4, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + epu8{0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), + epu8{3, 2, 1, 5, 4, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15})); + REQUIRE(equal( + permuted(epu8{3, 2, 5, 1, 4, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + epu8{2, 2, 1, 2, 3, 6, 12, 4, 5, 16, 17, 11, 12, 13, 14, 15}), + epu8{5, 5, 2, 5, 1, 6, 12, 4, 0, 3, 2, 11, 12, 13, 14, 15})); } -BOOST_FIXTURE_TEST_CASE(EPU8_shifted_left, Fix) { - EPU8_EQUAL(shifted_left(P01), P10); - EPU8_EQUAL(shifted_left(P112), (epu8{1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0})); - EPU8_EQUAL(shifted_left(Pv), - (epu8{ 5, 2, 5, 1, 6,12, 4, 0, 3, 2,11,12,13,14,15, 0})); +TEST_CASE_METHOD(Fix, "Epu8::shifted_left", "[Epu8][012]") { + REQUIRE(equal(shifted_left(P01), P10)); + REQUIRE(equal(shifted_left(P112), + epu8{1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0})); + REQUIRE(equal(shifted_left(Pv), + epu8{5, 2, 5, 1, 6, 12, 4, 0, 3, 2, 11, 12, 13, 14, 15, 0})); } -BOOST_FIXTURE_TEST_CASE(EPU8_shifted_right, Fix) { - EPU8_EQUAL(shifted_right(P10), P01); - EPU8_EQUAL(shifted_right(P112), Epu8({0,1,1}, 2)); - EPU8_EQUAL(shifted_right(Pv), - (epu8{ 0, 5, 5, 2, 5, 1, 6,12, 4, 0, 3, 2,11,12,13,14})); +TEST_CASE_METHOD(Fix, "Epu8::shifted_right", "[Epu8][013]") { + REQUIRE(equal(shifted_right(P10), P01)); + REQUIRE(equal(shifted_right(P112), Epu8({0, 1, 1}, 2))); + REQUIRE(equal(shifted_right(Pv), + epu8{0, 5, 5, 2, 5, 1, 6, 12, 4, 0, 3, 2, 11, 12, 13, 14})); } -BOOST_FIXTURE_TEST_CASE(EPU8_reverted, Fix) { - EPU8_EQUAL(reverted(epu8id), epu8rev); - for (auto x : v) EPU8_EQUAL(x, reverted(reverted(x))); +TEST_CASE_METHOD(Fix, "Epu8::reverted", "[Epu8][014]") { + REQUIRE(equal(reverted(epu8id), epu8rev)); + for (auto x : v) { + REQUIRE(equal(x, reverted(reverted(x)))); + } } -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_array) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_as_array, Fix) { +TEST_CASE_METHOD(Fix, "Epu8::as_array", "[Epu8][015]") { epu8 x = Epu8({4, 2, 5, 1, 2, 7, 7, 3, 4, 2}, 1); - auto & refx = as_array(x); + auto &refx = as_array(x); refx[2] = 42; - EPU8_EQUAL(x, Epu8({4, 2, 42, 1, 2, 7, 7, 3, 4, 2}, 1)); - std::fill(refx.begin()+4, refx.end(), 3); - EPU8_EQUAL(x, Epu8({4, 2, 42, 1}, 3)); - BOOST_TEST(av == as_array(Pv)); + REQUIRE(equal(x, Epu8({4, 2, 42, 1, 2, 7, 7, 3, 4, 2}, 1))); + std::fill(refx.begin() + 4, refx.end(), 3); + REQUIRE(equal(x, Epu8({4, 2, 42, 1}, 3))); + REQUIRE(av == as_array(Pv)); } -BOOST_FIXTURE_TEST_CASE(EPU8_from_array, Fix) { +TEST_CASE_METHOD(Fix, "Epu8::from_array", "[Epu8][016]") { for (auto x : v) { - EPU8_EQUAL(x, from_array(as_array(x))); + REQUIRE(equal(x, from_array(as_array(x)))); } - EPU8_EQUAL(Pv, from_array(av)); -} -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_sorting) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_is_sorted, Fix) { - BOOST_TEST(is_sorted(epu8id)); - BOOST_TEST(is_sorted(epu8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15})); - BOOST_TEST(is_sorted(Epu8({ 0, 1}, 2))); - BOOST_TEST(is_sorted(Epu8({0}, 1))); - BOOST_TEST(is_sorted(Epu8({}, 5))); - BOOST_TEST(not is_sorted(epu8{ 0, 1, 3, 2, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15})); - BOOST_TEST(not is_sorted(Epu8({ 0, 2}, 1))); - BOOST_TEST(not is_sorted(Epu8({ 0, 0, 2}, 1))); - BOOST_TEST(not is_sorted(Epu8({6}, 5))); + REQUIRE(equal(Pv, from_array(av))); +} + +TEST_CASE_METHOD(Fix, "Epu8::is_sorted", "[Epu8][017]") { + REQUIRE(is_sorted(epu8id)); + REQUIRE( + is_sorted(epu8{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15})); + REQUIRE(is_sorted(Epu8({0, 1}, 2))); + REQUIRE(is_sorted(Epu8({0}, 1))); + REQUIRE(is_sorted(Epu8({}, 5))); + REQUIRE( + !is_sorted(epu8{0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15})); + REQUIRE(!is_sorted(Epu8({0, 2}, 1))); + REQUIRE(!is_sorted(Epu8({0, 0, 2}, 1))); + REQUIRE(!is_sorted(Epu8({6}, 5))); epu8 x = epu8id; - BOOST_TEST(is_sorted(x)); - auto & refx = as_array(x); - while (std::next_permutation(refx.begin(), refx.begin()+9)) { - BOOST_TEST(not is_sorted(x)); + REQUIRE(is_sorted(x)); + auto &refx = as_array(x); + while (std::next_permutation(refx.begin(), refx.begin() + 9)) { + REQUIRE(!is_sorted(x)); } x = epu8id; - while (std::next_permutation(refx.begin()+8, refx.begin()+16)) { - BOOST_TEST(not is_sorted(x)); + while (std::next_permutation(refx.begin() + 8, refx.begin() + 16)) { + REQUIRE(!is_sorted(x)); } x = sorted(Pa1); - BOOST_TEST(is_sorted(x)); - while (std::next_permutation(refx.begin(), refx.begin()+14)) { - BOOST_TEST(not is_sorted(x)); + REQUIRE(is_sorted(x)); + while (std::next_permutation(refx.begin(), refx.begin() + 14)) { + REQUIRE(!is_sorted(x)); } } -BOOST_FIXTURE_TEST_CASE(EPU8_sorted, Fix) { - EPU8_EQUAL(sorted(epu8{ 0, 1, 3, 2, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15}), - epu8id); - for (auto &x : v) - BOOST_TEST(is_sorted(sorted(x))); +TEST_CASE_METHOD(Fix, "Epu8::sorted", "[Epu8][018]") { + REQUIRE(equal( + sorted(epu8{0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), + epu8id)); + for (auto &x : v) { + REQUIRE(is_sorted(sorted(x))); + } epu8 x = epu8id; - BOOST_TEST(is_sorted(x)); - auto & refx = as_array(x); + REQUIRE(is_sorted(x)); + auto &refx = as_array(x); do { - BOOST_TEST(is_sorted(sorted(x))); - } while (std::next_permutation(refx.begin(), refx.begin()+9)); + REQUIRE(is_sorted(sorted(x))); + } while (std::next_permutation(refx.begin(), refx.begin() + 9)); } -BOOST_FIXTURE_TEST_CASE(EPU8_revsorted, Fix) { - EPU8_EQUAL(revsorted(epu8{ 0, 1, 3, 2, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15}), - epu8rev); - for (auto &x : v) - BOOST_TEST(is_sorted(reverted(revsorted(x)))); +TEST_CASE_METHOD(Fix, "Epu8::revsorted", "[Epu8][019]") { + REQUIRE(equal( + revsorted(epu8{0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), + epu8rev)); + for (auto &x : v) { + REQUIRE(is_sorted(reverted(revsorted(x)))); + } epu8 x = epu8id; - BOOST_TEST(is_sorted(x)); - auto & refx = as_array(x); + REQUIRE(is_sorted(x)); + auto &refx = as_array(x); do { - BOOST_TEST(is_sorted(reverted(revsorted(x)))); - } while (std::next_permutation(refx.begin(), refx.begin()+9)); + REQUIRE(is_sorted(reverted(revsorted(x)))); + } while (std::next_permutation(refx.begin(), refx.begin() + 9)); } -BOOST_FIXTURE_TEST_CASE(EPU8_sort_perm, Fix) { - epu8 ve { 2, 1, 3, 2, 4, 1, 1, 4, 2, 0, 1, 2, 1, 3, 4, 0}; - EPU8_EQUAL(sort_perm(ve), - (epu8{ 9,15, 1, 5, 6,10,12, 3, 0, 8,11, 2,13, 7, 4,14})); - EPU8_EQUAL(ve, - (epu8{ 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4})); +TEST_CASE_METHOD(Fix, "Epu8::sort_perm", "[Epu8][020]") { + epu8 ve{2, 1, 3, 2, 4, 1, 1, 4, 2, 0, 1, 2, 1, 3, 4, 0}; + REQUIRE(equal(sort_perm(ve), + epu8{9, 15, 1, 5, 6, 10, 12, 3, 0, 8, 11, 2, 13, 7, 4, 14})); + REQUIRE(equal(ve, epu8{0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4})); for (auto x : v) { epu8 xsort = x; epu8 psort = sort_perm(xsort); - BOOST_TEST(is_sorted(xsort)); - BOOST_TEST(is_permutation(psort)); - EPU8_EQUAL(permuted(x, psort), xsort); + REQUIRE(is_sorted(xsort)); + REQUIRE(is_permutation(psort)); + REQUIRE(equal(permuted(x, psort), xsort)); } - } -BOOST_FIXTURE_TEST_CASE(EPU8_sort8_perm, Fix) { - epu8 ve { 2, 1, 3, 2, 4, 1, 1, 4, 2, 0, 1, 2, 1, 3, 4, 0}; - EPU8_EQUAL(sort8_perm(ve), - (epu8{ 1, 6, 5, 0, 3, 2, 4, 7, 9,15,10,12, 8,11,13,14})); - EPU8_EQUAL(ve, - (epu8{ 1, 1, 1, 2, 2, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3, 4})); +TEST_CASE_METHOD(Fix, "Epu8::sort8_perm", "[Epu8][021]") { + epu8 ve{2, 1, 3, 2, 4, 1, 1, 4, 2, 0, 1, 2, 1, 3, 4, 0}; + REQUIRE(equal(sort8_perm(ve), + epu8{1, 6, 5, 0, 3, 2, 4, 7, 9, 15, 10, 12, 8, 11, 13, 14})); + REQUIRE(equal(ve, epu8{1, 1, 1, 2, 2, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3, 4})); for (auto x : v) { epu8 xsort = x; epu8 psort = sort_perm(xsort); - BOOST_TEST(is_sorted(xsort | Epu8({0,0,0,0,0,0,0,0}, 0xFF))); - BOOST_TEST(is_sorted(xsort & Epu8({0,0,0,0,0,0,0,0}, 0xFF))); - BOOST_TEST(is_permutation(psort)); - EPU8_EQUAL(permuted(x, psort), xsort); + REQUIRE(is_sorted(xsort | Epu8({0, 0, 0, 0, 0, 0, 0, 0}, 0xFF))); + REQUIRE(is_sorted(xsort & Epu8({0, 0, 0, 0, 0, 0, 0, 0}, 0xFF))); + REQUIRE(is_permutation(psort)); + REQUIRE(equal(permuted(x, psort), xsort)); } - } - -BOOST_FIXTURE_TEST_CASE(EPU8_permutation_of, Fix) { - EPU8_EQUAL(permutation_of(epu8id, epu8id), epu8id); - EPU8_EQUAL(permutation_of(Pa, Pa), epu8id); - EPU8_EQUAL(permutation_of(epu8rev, epu8id), epu8rev); - EPU8_EQUAL(permutation_of(epu8id, epu8rev), epu8rev); - EPU8_EQUAL(permutation_of(epu8rev, epu8rev), epu8id); - EPU8_EQUAL(permutation_of(epu8id, RP), RP); - const uint8_t FF = 0xff; - EPU8_EQUAL((permutation_of(Pv, Pv) | -// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 -// epu8{ 5, 5, 2, 5, 1, 6,12, 4, 0, 3, 2,11,12,13,14,15} - (epu8{FF,FF,FF,FF, 0, 0,FF, 0, 0, 0,FF, 0,FF, 0, 0, 0})), - (epu8 {FF,FF,FF,FF, 4, 5,FF, 7, 8, 9,FF,11,FF,13,14,15})); -} -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_remove_dups_sum) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_remove_dups, Fix) { - EPU8_EQUAL(remove_dups(P1), P10); - EPU8_EQUAL(remove_dups(P11), P10); - EPU8_EQUAL(remove_dups(sorted(P10)), - (epu8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1})); - EPU8_EQUAL(remove_dups(sorted(Pv)), - (epu8{ 0, 1, 2, 0, 3, 4, 5, 0, 0, 6,11,12, 0,13,14,15})); - EPU8_EQUAL(remove_dups(P1, 1), P1); - EPU8_EQUAL(remove_dups(P11, 1), Epu8({1,1,0},1)); - EPU8_EQUAL(remove_dups(P11, 42), Epu8({1,42,0},42)); - EPU8_EQUAL(remove_dups(sorted(P10), 1), P1); - EPU8_EQUAL(remove_dups(sorted(Pv), 7), - (epu8{ 7, 1, 2, 7, 3, 4, 5, 7, 7, 6,11,12, 7,13,14,15})); +// TODO uncomment +// TEST_CASE_METHOD(Fix, "Epu8::permutation_of", "[Epu8][022]") { +// REQUIRE(equal(permutation_of(epu8id, epu8id), epu8id)); +// REQUIRE(equal(permutation_of(Pa, Pa), epu8id)); +// REQUIRE(equal(permutation_of(epu8rev, epu8id), epu8rev)); +// REQUIRE(equal(permutation_of(epu8id, epu8rev), epu8rev)); +// REQUIRE(equal(permutation_of(epu8rev, epu8rev), epu8id)); +// REQUIRE(equal(permutation_of(epu8id, RP), RP)); +// const uint8_t FF = 0xff; +// REQUIRE(equal( +// (permutation_of(Pv, Pv) | +// epu8{FF, FF, FF, FF, 0, 0, FF, 0, 0, 0, FF, 0, FF, 0, 0, 0})), +// epu8{FF, FF, FF, FF, 4, 5, FF, 7, 8, 9, FF, 11, FF, 13, 14, 15}); +// } +// +TEST_CASE_METHOD(Fix, "Epu8::remove_dups", "[Epu8][023]") { + REQUIRE(equal(remove_dups(P1), P10)); + REQUIRE(equal(remove_dups(P11), P10)); + REQUIRE(equal(remove_dups(sorted(P10)), + epu8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1})); + REQUIRE(equal(remove_dups(sorted(Pv)), + epu8{0, 1, 2, 0, 3, 4, 5, 0, 0, 6, 11, 12, 0, 13, 14, 15})); + REQUIRE(equal(remove_dups(P1, 1), P1)); + REQUIRE(equal(remove_dups(P11, 1), Epu8({1, 1, 0}, 1))); + REQUIRE(equal(remove_dups(P11, 42), Epu8({1, 42, 0}, 42))); + REQUIRE(equal(remove_dups(sorted(P10), 1), P1)); + REQUIRE(equal(remove_dups(sorted(Pv), 7), + epu8{7, 1, 2, 7, 3, 4, 5, 7, 7, 6, 11, 12, 7, 13, 14, 15})); for (auto x : v) { x = sorted(remove_dups(sorted(x))); - EPU8_EQUAL(x, sorted(remove_dups(x))); + REQUIRE(equal(x, sorted(remove_dups(x)))); } for (auto x : v) { x = sorted(remove_dups(sorted(x), 42)); - EPU8_EQUAL(x, sorted(remove_dups(x, 42))); + REQUIRE(equal(x, sorted(remove_dups(x, 42)))); } } -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_horiz_sum) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_horiz_sum_ref, Fix) { - BOOST_TEST(horiz_sum_ref(zero) == 0); - BOOST_TEST(horiz_sum_ref(P01) == 1); - BOOST_TEST(horiz_sum_ref(epu8id) == 120); - BOOST_TEST(horiz_sum_ref(P10) == 1); - BOOST_TEST(horiz_sum_ref(P11) == 2); - BOOST_TEST(horiz_sum_ref(P1) == 16); - BOOST_TEST(horiz_sum_ref(P112) == 30); - BOOST_TEST(horiz_sum_ref(Pa1) == 43); - BOOST_TEST(horiz_sum_ref(Pa2) == 45); - BOOST_TEST(horiz_sum_ref(P51) == 90); - BOOST_TEST(horiz_sum_ref(Pv) == 110); - BOOST_TEST(horiz_sum_ref(P5) == 80); - BOOST_TEST(horiz_sum_ref(epu8rev) == 120); - BOOST_TEST(horiz_sum_ref(Pc) == 203); -} -TEST_AGREES(horiz_sum_ref, horiz_sum_gen) -TEST_AGREES(horiz_sum_ref, horiz_sum4) -TEST_AGREES(horiz_sum_ref, horiz_sum3) -TEST_AGREES(horiz_sum_ref, horiz_sum) -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_partial_sums) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_partial_sums_ref, Fix) { - EPU8_EQUAL(partial_sums_ref(zero), zero); - EPU8_EQUAL(partial_sums_ref(P01), Epu8({0}, 1)); - EPU8_EQUAL(partial_sums_ref(epu8id), - (epu8{ 0, 1, 3, 6,10,15,21,28,36,45,55,66,78,91,105,120})); - EPU8_EQUAL(partial_sums_ref(P10), P1); - EPU8_EQUAL(partial_sums_ref(P11), Epu8({1}, 2)); - EPU8_EQUAL(partial_sums_ref(P1), epu8id + Epu8({}, 1)); - EPU8_EQUAL(partial_sums_ref(P112), - (epu8{ 1, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30})); - EPU8_EQUAL(partial_sums_ref(Pa1), - (epu8{ 4, 6,11,12,14,21,28,31,35,37,38,39,40,41,42,43})); - EPU8_EQUAL(partial_sums_ref(Pa2), - (epu8{ 4, 6,11,12,14,23,30,33,37,39,40,41,42,43,44,45})); - EPU8_EQUAL(partial_sums_ref(P51), - (epu8{ 5, 6,12,18,24,30,36,42,48,54,60,66,72,78,84,90})); - EPU8_EQUAL(partial_sums_ref(Pv), - (epu8{ 5,10,12,17,18,24,36,40,40,43,45,56,68,81,95,110})); - EPU8_EQUAL(partial_sums_ref(P5), - (epu8{ 5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80})); - EPU8_EQUAL(partial_sums_ref(epu8rev), - (epu8{15,29,42,54,65,75,84,92,99,105,110,114,117,119,120,120})); - EPU8_EQUAL(partial_sums_ref(Pc), - (epu8{23,28,49,54,97,133,140,147,154,161,168,175,182,189,196,203})); -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_sum_gen, Fix) { - for (auto x : v) EPU8_EQUAL(partial_sums_gen(x), partial_sums_ref(x)); -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_sum_round, Fix) { - for (auto x : v) EPU8_EQUAL(partial_sums_round(x), partial_sums_ref(x)); -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_sum, Fix) { - for (auto x : v) EPU8_EQUAL(partial_sums(x), partial_sums_ref(x)); -} -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_horiz_max) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_horiz_max_ref, Fix) { - BOOST_TEST(horiz_max_ref(zero) == 0); - BOOST_TEST(horiz_max_ref(P01) == 1); - BOOST_TEST(horiz_max_ref(epu8id) == 15); - BOOST_TEST(horiz_max_ref(P10) == 1); - BOOST_TEST(horiz_max_ref(P11) == 1); - BOOST_TEST(horiz_max_ref(P1) == 1); - BOOST_TEST(horiz_max_ref(P112) == 2); - BOOST_TEST(horiz_max_ref(Pa1) == 7); - BOOST_TEST(horiz_max_ref(Pa2) == 9); - BOOST_TEST(horiz_max_ref(P51) == 6); - BOOST_TEST(horiz_max_ref(Pv) == 15); - BOOST_TEST(horiz_max_ref(P5) == 5); - BOOST_TEST(horiz_max_ref(epu8rev) == 15); - BOOST_TEST(horiz_max_ref(Pc) == 43); -} -TEST_AGREES(horiz_max_ref, horiz_max_gen) -TEST_AGREES(horiz_max_ref, horiz_max4) -TEST_AGREES(horiz_max_ref, horiz_max3) -TEST_AGREES(horiz_max_ref, horiz_max) -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_partial_max) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_partial_max_ref, Fix) { - EPU8_EQUAL(partial_max_ref(zero), zero); - EPU8_EQUAL(partial_max_ref(P01), Epu8({0}, 1)); - EPU8_EQUAL(partial_max_ref(epu8id), epu8id); - EPU8_EQUAL(partial_max_ref(P10), P1); - EPU8_EQUAL(partial_max_ref(P11), P1); - EPU8_EQUAL(partial_max_ref(P1), P1); - EPU8_EQUAL(partial_max_ref(P112), P112); - EPU8_EQUAL(partial_max_ref(Pa1), (Epu8({4, 4, 5, 5, 5}, 7))); - EPU8_EQUAL(partial_max_ref(Pa2), (Epu8({4, 4, 5, 5, 5}, 9))); - EPU8_EQUAL(partial_max_ref(P51), (Epu8({5, 5}, 6))); - EPU8_EQUAL(partial_max_ref(Pv), - (epu8{ 5, 5, 5, 5, 5, 6,12,12,12,12,12,12,12,13,14,15})); - EPU8_EQUAL(partial_max_ref(P5), P5); - EPU8_EQUAL(partial_max_ref(epu8rev), Epu8({}, 15)); - EPU8_EQUAL(partial_max_ref(Pc), (Epu8({23,23,23,23}, 43))); - -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_sum_gen, Fix) { - for (auto x : v) EPU8_EQUAL(partial_max_gen(x), partial_max_ref(x)); -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_max_round, Fix) { - for (auto x : v) EPU8_EQUAL(partial_max_round(x), partial_max_ref(x)); -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_max, Fix) { - for (auto x : v) EPU8_EQUAL(partial_max(x), partial_max_ref(x)); -} -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_horiz_min) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_horiz_min_ref, Fix) { - BOOST_TEST(horiz_min_ref(zero) == 0); - BOOST_TEST(horiz_min_ref(P01) == 0); - BOOST_TEST(horiz_min_ref(epu8id) == 0); - BOOST_TEST(horiz_min_ref(P10) == 0); - BOOST_TEST(horiz_min_ref(P11) == 0); - BOOST_TEST(horiz_min_ref(P1) == 1); - BOOST_TEST(horiz_min_ref(P112) == 1); - BOOST_TEST(horiz_min_ref(Pa1) == 1); - BOOST_TEST(horiz_min_ref(Pa2) == 1); - BOOST_TEST(horiz_min_ref(P51) == 1); - BOOST_TEST(horiz_min_ref(Pv) == 0); - BOOST_TEST(horiz_min_ref(P5) == 5); - BOOST_TEST(horiz_min_ref(epu8rev) == 0); - BOOST_TEST(horiz_min_ref(Pc) == 5); -} -TEST_AGREES(horiz_min_ref, horiz_min_gen) -TEST_AGREES(horiz_min_ref, horiz_min4) -TEST_AGREES(horiz_min_ref, horiz_min3) -TEST_AGREES(horiz_min_ref, horiz_min) -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_partial_min) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_partial_min_ref, Fix) { - EPU8_EQUAL(partial_min_ref(zero), zero); - EPU8_EQUAL(partial_min_ref(P01), zero); - EPU8_EQUAL(partial_min_ref(epu8id), zero); - EPU8_EQUAL(partial_min_ref(P10), P10); - EPU8_EQUAL(partial_min_ref(P11), P11); - EPU8_EQUAL(partial_min_ref(P1), P1); - EPU8_EQUAL(partial_min_ref(P112), P1); - EPU8_EQUAL(partial_min_ref(Pa1), (Epu8({4, 2, 2}, 1))); - EPU8_EQUAL(partial_min_ref(Pa2), (Epu8({4, 2, 2}, 1))); - EPU8_EQUAL(partial_min_ref(P51), (Epu8({5}, 1))); - EPU8_EQUAL(partial_min_ref(Pv), - (Epu8({ 5, 5, 2, 2, 1, 1, 1, 1,}, 0))); - EPU8_EQUAL(partial_min_ref(P5), P5); - EPU8_EQUAL(partial_min_ref(epu8rev), epu8rev); - EPU8_EQUAL(partial_min_ref(Pc), (Epu8({23}, 5))); - -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_sum_gen, Fix) { - for (auto x : v) EPU8_EQUAL(partial_min_gen(x), partial_min_ref(x)); -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_min_round, Fix) { - for (auto x : v) EPU8_EQUAL(partial_min_round(x), partial_min_ref(x)); -} -BOOST_FIXTURE_TEST_CASE(EPU8_partial_min, Fix) { - for (auto x : v) EPU8_EQUAL(partial_min(x), partial_min_ref(x)); -} -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_eval16) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_eval16_ref, Fix) { - EPU8_EQUAL(eval16_ref(zero), Epu8({16}, 0)); - EPU8_EQUAL(eval16_ref(P01), Epu8({15, 1}, 0)); - EPU8_EQUAL(eval16_ref(epu8id), Epu8({}, 1)); - EPU8_EQUAL(eval16_ref(P10), Epu8({15, 1}, 0)); - EPU8_EQUAL(eval16_ref(P11), Epu8({14, 2}, 0)); - EPU8_EQUAL(eval16_ref(P1), Epu8({0, 16}, 0)); - EPU8_EQUAL(eval16_ref(P112), Epu8({0, 2, 14}, 0)); - EPU8_EQUAL(eval16_ref(Pa1), Epu8({0, 7, 3, 1, 2, 1, 0, 2}, 0)); - EPU8_EQUAL(eval16_ref(Pa2), Epu8({ 0, 7, 3, 1, 2, 1, 0, 1, 0, 1}, 0)); - EPU8_EQUAL(eval16_ref(P51), Epu8({ 0, 1, 0, 0, 0, 1,14}, 0)); - EPU8_EQUAL(eval16_ref(Pv), - (epu8{ 1, 1, 2, 1, 1, 3, 1, 0, 0, 0, 0, 1, 2, 1, 1, 1})); - EPU8_EQUAL(eval16_ref(P5), Epu8({ 0, 0, 0, 0, 0, 16}, 0)); - EPU8_EQUAL(eval16_ref(epu8rev), Epu8({}, 1)); - EPU8_EQUAL(eval16_ref(Pc), Epu8({ 0, 0, 0, 0, 0, 2, 0,10}, 0)); -} -TEST_EPU8_AGREES(eval16_ref, eval16_cycle) -TEST_EPU8_AGREES(eval16_ref, eval16_popcount) -TEST_EPU8_AGREES(eval16_ref, eval16_arr) -TEST_EPU8_AGREES(eval16_ref, eval16_gen) -TEST_EPU8_AGREES(eval16_ref, eval16) -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_vector_popcount) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(EPU8_popcount4, Fix) { - EPU8_EQUAL(popcount4, - (epu8 { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4})); -} - -BOOST_FIXTURE_TEST_CASE(EPU8_popcount, Fix) { - EPU8_EQUAL(popcount16(Pv), - (epu8 {2, 2, 1, 2, 1, 2, 2, 1, 0, 2, 1, 3, 2, 3, 3, 4})); - EPU8_EQUAL(popcount16(RP), - (epu8 {2, 1, 0, 3, 4, 3, 2, 2, 1, 3, 2, 2, 3, 1, 1, 2})); - EPU8_EQUAL(popcount16(RP << 1), - (epu8 {2, 1, 0, 3, 4, 3, 2, 2, 1, 3, 2, 2, 3, 1, 1, 2})); - EPU8_EQUAL(popcount16(RP << 2), - (epu8 {2, 1, 0, 3, 4, 3, 2, 2, 1, 3, 2, 2, 3, 1, 1, 2})); - EPU8_EQUAL(popcount16(Epu8({0,1,5,0xff, 0xf0, 0x35}, 0x0f)), - (Epu8({0,1,2,8}, 4))); -} -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_random) -//****************************************************************************// - -BOOST_AUTO_TEST_CASE(Random) { - for (int i = 0; i<10 ; i++) { + +TEST_CASE_METHOD(Fix, "Epu8::horiz_sum_ref", "[Epu8][024]") { + REQUIRE(horiz_sum_ref(zero) == 0); + REQUIRE(horiz_sum_ref(P01) == 1); + REQUIRE(horiz_sum_ref(epu8id) == 120); + REQUIRE(horiz_sum_ref(P10) == 1); + REQUIRE(horiz_sum_ref(P11) == 2); + REQUIRE(horiz_sum_ref(P1) == 16); + REQUIRE(horiz_sum_ref(P112) == 30); + REQUIRE(horiz_sum_ref(Pa1) == 43); + REQUIRE(horiz_sum_ref(Pa2) == 45); + REQUIRE(horiz_sum_ref(P51) == 90); + REQUIRE(horiz_sum_ref(Pv) == 110); + REQUIRE(horiz_sum_ref(P5) == 80); + REQUIRE(horiz_sum_ref(epu8rev) == 120); + REQUIRE(horiz_sum_ref(Pc) == 203); +} + +// TODO uncomment, compiler complains that Epu8 is an unknown type!? +// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum_gen, v, "[Epu8][025]") +// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum4, v, "[Epu8][026]") +// +// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum3, v, "[Epu8][027]") +// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum, v, "[Epu8][028]") + +TEST_CASE_METHOD(Fix, "Epu8::partial_sums_ref", "[Epu8][029]") { + REQUIRE(equal(partial_sums_ref(zero), zero)); + REQUIRE(equal(partial_sums_ref(P01), Epu8({0}, 1))); + REQUIRE( + equal(partial_sums_ref(epu8id), epu8{0, 1, 3, 6, 10, 15, 21, 28, 36, 45, + 55, 66, 78, 91, 105, 120})); + REQUIRE(equal(partial_sums_ref(P10), P1)); + REQUIRE(equal(partial_sums_ref(P11), Epu8({1}, 2))); + REQUIRE(equal(partial_sums_ref(P1), epu8id + Epu8({}, 1))); + REQUIRE(equal(partial_sums_ref(P112), epu8{1, 2, 4, 6, 8, 10, 12, 14, 16, + 18, 20, 22, 24, 26, 28, 30})); + REQUIRE(equal(partial_sums_ref(Pa1), epu8{4, 6, 11, 12, 14, 21, 28, 31, 35, + 37, 38, 39, 40, 41, 42, 43})); + + REQUIRE(equal(partial_sums_ref(Pa2), epu8{4, 6, 11, 12, 14, 23, 30, 33, 37, + 39, 40, 41, 42, 43, 44, 45})); + REQUIRE(equal(partial_sums_ref(P51), epu8{5, 6, 12, 18, 24, 30, 36, 42, 48, + 54, 60, 66, 72, 78, 84, 90})); + REQUIRE(equal(partial_sums_ref(Pv), epu8{5, 10, 12, 17, 18, 24, 36, 40, 40, + 43, 45, 56, 68, 81, 95, 110})); + REQUIRE(equal(partial_sums_ref(P5), epu8{5, 10, 15, 20, 25, 30, 35, 40, 45, + 50, 55, 60, 65, 70, 75, 80})); + REQUIRE(equal(partial_sums_ref(epu8rev), + epu8{15, 29, 42, 54, 65, 75, 84, 92, 99, 105, 110, 114, 117, + 119, 120, 120})); + REQUIRE( + equal(partial_sums_ref(Pc), epu8{23, 28, 49, 54, 97, 133, 140, 147, 154, + 161, 168, 175, 182, 189, 196, 203})); +} + +TEST_CASE_METHOD(Fix, "Epu8::partial_sum_gen", "[Epu8][030]") { + for (auto x : v) { + REQUIRE(equal(partial_sums_gen(x), partial_sums_ref(x))); + } +} +TEST_CASE_METHOD(Fix, "Epu8::partial_sum_round", "[Epu8][031]") { + for (auto x : v) { + REQUIRE(equal(partial_sums_round(x), partial_sums_ref(x))); + } +} +TEST_CASE_METHOD(Fix, "Epu8::partial_sum", "[Epu8][032]") { + for (auto x : v) { + REQUIRE(equal(partial_sums(x), partial_sums_ref(x))); + } +} + +TEST_CASE_METHOD(Fix, "Epu8::horiz_max_ref", "[Epu8][033]") { + REQUIRE(horiz_max_ref(zero) == 0); + REQUIRE(horiz_max_ref(P01) == 1); + REQUIRE(horiz_max_ref(epu8id) == 15); + REQUIRE(horiz_max_ref(P10) == 1); + REQUIRE(horiz_max_ref(P11) == 1); + REQUIRE(horiz_max_ref(P1) == 1); + REQUIRE(horiz_max_ref(P112) == 2); + REQUIRE(horiz_max_ref(Pa1) == 7); + REQUIRE(horiz_max_ref(Pa2) == 9); + REQUIRE(horiz_max_ref(P51) == 6); + REQUIRE(horiz_max_ref(Pv) == 15); + REQUIRE(horiz_max_ref(P5) == 5); + REQUIRE(horiz_max_ref(epu8rev) == 15); + REQUIRE(horiz_max_ref(Pc) == 43); +} + +// TODO uncomment, compiler complains that Epu8 is an unknown type!? +// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max_gen, v, "[Epu8][034]") +// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max4, v, "[Epu8][035]") +// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max3, v, "[Epu8][036]") +// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max, v, "[Epu8][037]") + +TEST_CASE_METHOD(Fix, "Epu8::partial_max_ref", "[Epu8][038]") { + REQUIRE(equal(partial_max_ref(zero), zero)); + REQUIRE(equal(partial_max_ref(P01), Epu8({0}, 1))); + REQUIRE(equal(partial_max_ref(epu8id), epu8id)); + REQUIRE(equal(partial_max_ref(P10), P1)); + REQUIRE(equal(partial_max_ref(P11), P1)); + REQUIRE(equal(partial_max_ref(P1), P1)); + REQUIRE(equal(partial_max_ref(P112), P112)); + REQUIRE(equal(partial_max_ref(Pa1), Epu8({4, 4, 5, 5, 5}, 7))); + REQUIRE(equal(partial_max_ref(Pa2), Epu8({4, 4, 5, 5, 5}, 9))); + REQUIRE(equal(partial_max_ref(P51), Epu8({5, 5}, 6))); + REQUIRE(equal(partial_max_ref(Pv), epu8{5, 5, 5, 5, 5, 6, 12, 12, 12, 12, + 12, 12, 12, 13, 14, 15})); + REQUIRE(equal(partial_max_ref(P5), P5)); + REQUIRE(equal(partial_max_ref(epu8rev), Epu8({}, 15))); + REQUIRE(equal(partial_max_ref(Pc), Epu8({23, 23, 23, 23}, 43))); +} + +TEST_CASE_METHOD(Fix, "Epu8::partial_max_gen", "[Epu8][039]") { + for (auto x : v) { + REQUIRE(equal(partial_max_gen(x), partial_max_ref(x))); + } +} + +TEST_CASE_METHOD(Fix, "Epu8::partial_max_round", "[Epu8][040]") { + for (auto x : v) { + REQUIRE(equal(partial_max_round(x), partial_max_ref(x))); + } +} + +TEST_CASE_METHOD(Fix, "Epu8::partial_max", "[Epu8][041]") { + for (auto x : v) { + REQUIRE(equal(partial_max(x), partial_max_ref(x))); + } +} + +TEST_CASE_METHOD(Fix, "Epu8::horiz_min_ref", "[Epu8][042]") { + REQUIRE(horiz_min_ref(zero) == 0); + REQUIRE(horiz_min_ref(P01) == 0); + REQUIRE(horiz_min_ref(epu8id) == 0); + REQUIRE(horiz_min_ref(P10) == 0); + REQUIRE(horiz_min_ref(P11) == 0); + REQUIRE(horiz_min_ref(P1) == 1); + REQUIRE(horiz_min_ref(P112) == 1); + REQUIRE(horiz_min_ref(Pa1) == 1); + REQUIRE(horiz_min_ref(Pa2) == 1); + REQUIRE(horiz_min_ref(P51) == 1); + REQUIRE(horiz_min_ref(Pv) == 0); + REQUIRE(horiz_min_ref(P5) == 5); + REQUIRE(horiz_min_ref(epu8rev) == 0); + REQUIRE(horiz_min_ref(Pc) == 5); +} +// TODO uncomment +// TEST_AGREES(horiz_min_ref, horiz_min_gen) +// TEST_AGREES(horiz_min_ref, horiz_min4) +// TEST_AGREES(horiz_min_ref, horiz_min3) +// TEST_AGREES(horiz_min_ref, horiz_min) + +TEST_CASE_METHOD(Fix, "Epu8::partial_min_ref", "[Epu8][043]") { + REQUIRE(equal(partial_min_ref(zero), zero)); + REQUIRE(equal(partial_min_ref(P01), zero)); + REQUIRE(equal(partial_min_ref(epu8id), zero)); + REQUIRE(equal(partial_min_ref(P10), P10)); + REQUIRE(equal(partial_min_ref(P11), P11)); + REQUIRE(equal(partial_min_ref(P1), P1)); + REQUIRE(equal(partial_min_ref(P112), P1)); + REQUIRE(equal(partial_min_ref(Pa1), Epu8({4, 2, 2}, 1))); + REQUIRE(equal(partial_min_ref(Pa2), Epu8({4, 2, 2}, 1))); + REQUIRE(equal(partial_min_ref(P51), Epu8({5}, 1))); + REQUIRE(equal(partial_min_ref(Pv), Epu8( + { + 5, + 5, + 2, + 2, + 1, + 1, + 1, + 1, + }, + 0))); + REQUIRE(equal(partial_min_ref(P5), P5)); + REQUIRE(equal(partial_min_ref(epu8rev), epu8rev)); + REQUIRE(equal(partial_min_ref(Pc), Epu8({23}, 5))); +} + +TEST_CASE_METHOD(Fix, "Epu8::partial_min_gen", "[Epu8][044]") { + for (auto x : v) { + REQUIRE(equal(partial_min_gen(x), partial_min_ref(x))); + } +} + +TEST_CASE_METHOD(Fix, "Epu8::partial_min_round", "[Epu8][045]") { + for (auto x : v) { + REQUIRE(equal(partial_min_round(x), partial_min_ref(x))); + } +} + +TEST_CASE_METHOD(Fix, "Epu8::partial_min", "[Epu8][046]") { + for (auto x : v) { + REQUIRE(equal(partial_min(x), partial_min_ref(x))); + } +} + +TEST_CASE_METHOD(Fix, "Epu8::eval16_ref", "[Epu8][047]") { + REQUIRE(equal(eval16_ref(zero), Epu8({16}, 0))); + REQUIRE(equal(eval16_ref(P01), Epu8({15, 1}, 0))); + REQUIRE(equal(eval16_ref(epu8id), Epu8({}, 1))); + REQUIRE(equal(eval16_ref(P10), Epu8({15, 1}, 0))); + REQUIRE(equal(eval16_ref(P11), Epu8({14, 2}, 0))); + REQUIRE(equal(eval16_ref(P1), Epu8({0, 16}, 0))); + REQUIRE(equal(eval16_ref(P112), Epu8({0, 2, 14}, 0))); + REQUIRE(equal(eval16_ref(Pa1), Epu8({0, 7, 3, 1, 2, 1, 0, 2}, 0))); + REQUIRE(equal(eval16_ref(Pa2), Epu8({0, 7, 3, 1, 2, 1, 0, 1, 0, 1}, 0))); + REQUIRE(equal(eval16_ref(P51), Epu8({0, 1, 0, 0, 0, 1, 14}, 0))); + REQUIRE(equal(eval16_ref(Pv), + epu8{1, 1, 2, 1, 1, 3, 1, 0, 0, 0, 0, 1, 2, 1, 1, 1})); + REQUIRE(equal(eval16_ref(P5), Epu8({0, 0, 0, 0, 0, 16}, 0))); + REQUIRE(equal(eval16_ref(epu8rev), Epu8({}, 1))); + REQUIRE(equal(eval16_ref(Pc), Epu8({0, 0, 0, 0, 0, 2, 0, 10}, 0))); +} +// TODO uncomment +// TEST_Epu8::AGREES(eval16_ref, eval16_cycle, "[Epu8][000]") +// TEST_Epu8::AGREES(eval16_ref, eval16_popcount, "[Epu8][000]") +// TEST_Epu8::AGREES(eval16_ref, eval16_arr, "[Epu8][000]") +// TEST_Epu8::AGREES(eval16_ref, eval16_gen, "[Epu8][000]") +// TEST_Epu8::AGREES(eval16_ref, eval16, "[Epu8][000]") + +TEST_CASE("Epu8::popcount4", "[Epu8][048]") { + REQUIRE( + equal(popcount4, epu8{0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4})); +} + +TEST_CASE_METHOD(Fix, "Epu8::popcount16", "[Epu8][049]") { + REQUIRE(equal(popcount16(Pv), + epu8{2, 2, 1, 2, 1, 2, 2, 1, 0, 2, 1, 3, 2, 3, 3, 4})); + REQUIRE(equal(popcount16(RP), + epu8{2, 1, 0, 3, 4, 3, 2, 2, 1, 3, 2, 2, 3, 1, 1, 2})); + REQUIRE(equal(popcount16(RP << 1), + epu8{2, 1, 0, 3, 4, 3, 2, 2, 1, 3, 2, 2, 3, 1, 1, 2})); + REQUIRE(equal(popcount16(RP << 2), + epu8{2, 1, 0, 3, 4, 3, 2, 2, 1, 3, 2, 2, 3, 1, 1, 2})); + REQUIRE(equal(popcount16(Epu8({0, 1, 5, 0xff, 0xf0, 0x35}, 0x0f)), + Epu8({0, 1, 2, 8}, 4))); +} + +TEST_CASE("random_epu8", "[Epu8][050]") { + for (int i = 0; i < 10; i++) { epu8 r = random_epu8(255); - EPU8_EQUAL(r, r); + REQUIRE(equal(r, r)); } } -//****************************************************************************// -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(EPU8_PermTransf16_test) -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(IsPTransf, Fix) { - BOOST_TEST(is_partial_transformation(zero)); - BOOST_TEST(is_partial_transformation(P01)); - BOOST_TEST(is_partial_transformation(P10)); - BOOST_TEST(not is_partial_transformation(Epu8({16}, 0))); - BOOST_TEST(is_partial_transformation(Epu8({}, 0xff))); - BOOST_TEST(is_partial_transformation(Epu8({2, 0xff, 3}, 0))); - - BOOST_TEST(not is_partial_transformation(zero, 15)); - BOOST_TEST(is_partial_transformation(Pa)); - BOOST_TEST(is_partial_transformation(Pa, 6)); - BOOST_TEST(is_partial_transformation(Pa, 5)); - BOOST_TEST(not is_partial_transformation(Pa, 4)); - BOOST_TEST(not is_partial_transformation(Pa, 1)); - BOOST_TEST(not is_partial_transformation(Pa, 0)); - - BOOST_TEST(is_partial_transformation(RP)); - BOOST_TEST(is_partial_transformation(RP, 16)); - BOOST_TEST(not is_partial_transformation(RP, 15)); - BOOST_TEST(is_partial_transformation(Epu8({1,2,1,0xFF,0,5,0xFF,2}, 0))); - BOOST_TEST(not is_partial_transformation(Epu8({1,2,1,0xFF,0,16,0xFF,2}, 0))); -} - -BOOST_FIXTURE_TEST_CASE(IsTransf, Fix) { - BOOST_TEST(is_transformation(zero)); - BOOST_TEST(is_transformation(P01)); - BOOST_TEST(is_transformation(P10)); - BOOST_TEST(not is_transformation(Epu8({16}, 0))); - BOOST_TEST(not is_transformation(Epu8({}, 0xff))); - BOOST_TEST(not is_transformation(Epu8({2, 0xff, 3}, 0))); - - BOOST_TEST(not is_transformation(zero, 15)); - BOOST_TEST(is_transformation(Pa)); - BOOST_TEST(is_transformation(Pa, 6)); - BOOST_TEST(is_transformation(Pa, 5)); - BOOST_TEST(not is_transformation(Pa, 4)); - BOOST_TEST(not is_transformation(Pa, 1)); - BOOST_TEST(not is_transformation(Pa, 0)); - - BOOST_TEST(is_transformation(RP)); - BOOST_TEST(is_transformation(RP, 16)); - BOOST_TEST(not is_transformation(RP, 15)); -} - -BOOST_FIXTURE_TEST_CASE(IsPPerm, Fix) { - BOOST_TEST(not is_partial_permutation(zero)); - BOOST_TEST(not is_partial_permutation(P01)); - BOOST_TEST(not is_partial_permutation(P10)); - BOOST_TEST(not is_partial_permutation(Epu8({16}, 0))); - BOOST_TEST(is_partial_permutation(Epu8({}, 0xff))); - BOOST_TEST(not is_partial_permutation(Epu8({2, 0xff, 3}, 0))); - BOOST_TEST(is_partial_permutation(Epu8({2, 0xff, 3}, 0xff))); - - BOOST_TEST(not is_partial_permutation(zero, 15)); - BOOST_TEST(is_partial_permutation(Pa)); - BOOST_TEST(is_partial_permutation(Pa, 6)); - BOOST_TEST(is_partial_permutation(Pa, 5)); - BOOST_TEST(not is_partial_permutation(Pa, 4)); - BOOST_TEST(not is_partial_permutation(Pa, 1)); - BOOST_TEST(not is_partial_permutation(Pa, 0)); - - BOOST_TEST(is_partial_permutation(RP)); - BOOST_TEST(is_partial_permutation(RP, 16)); - BOOST_TEST(not is_partial_permutation(RP, 15)); - - BOOST_TEST(is_partial_permutation( - epu8 {1,2,0xFF,0xFF,0,5,0xFF,3,8,9,10,11,12,13,14,15})); - BOOST_TEST(not is_partial_permutation( - epu8 {1,2,1,0xFF,0,5,0xFF,2,8,9,10,11,12,13,14,15})); - BOOST_TEST(not is_partial_permutation(Epu8({1,2,1,0xFF,0,5,0xFF,2}, 0))); - BOOST_TEST(not is_partial_permutation(Epu8({1,2,1,0xFF,0,16,0xFF,2}, 0))); -} - -BOOST_FIXTURE_TEST_CASE(IsPerm, Fix) { - BOOST_TEST(not is_permutation(zero)); - BOOST_TEST(not is_permutation(P01)); - BOOST_TEST(not is_permutation(P10)); - BOOST_TEST(not is_permutation(Epu8({16}, 0))); - BOOST_TEST(not is_permutation(Epu8({}, 0xff))); - BOOST_TEST(not is_permutation(Epu8({2, 0xff, 3}, 0))); - - BOOST_TEST(not is_permutation(zero, 15)); - BOOST_TEST(is_permutation(Pa)); - BOOST_TEST(is_permutation(Pa, 6)); - BOOST_TEST(is_permutation(Pa, 5)); - BOOST_TEST(not is_permutation(Pa, 4)); - BOOST_TEST(not is_permutation(Pa, 1)); - BOOST_TEST(not is_permutation(Pa, 0)); - - BOOST_TEST(is_permutation(RP)); - BOOST_TEST(is_permutation(RP, 16)); - BOOST_TEST(not is_permutation(RP, 15)); -} - -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// + +TEST_CASE_METHOD(Fix, "is_partial_transformation", "[Epu8][051]") { + REQUIRE(is_partial_transformation(zero)); + REQUIRE(is_partial_transformation(P01)); + REQUIRE(is_partial_transformation(P10)); + REQUIRE(!is_partial_transformation(Epu8({16}, 0))); + REQUIRE(is_partial_transformation(Epu8({}, 0xff))); + REQUIRE(is_partial_transformation(Epu8({2, 0xff, 3}, 0))); + + REQUIRE(!is_partial_transformation(zero, 15)); + REQUIRE(is_partial_transformation(Pa)); + REQUIRE(is_partial_transformation(Pa, 6)); + REQUIRE(is_partial_transformation(Pa, 5)); + REQUIRE(!is_partial_transformation(Pa, 4)); + REQUIRE(!is_partial_transformation(Pa, 1)); + REQUIRE(!is_partial_transformation(Pa, 0)); + + REQUIRE(is_partial_transformation(RP)); + REQUIRE(is_partial_transformation(RP, 16)); + REQUIRE(!is_partial_transformation(RP, 15)); + REQUIRE(is_partial_transformation(Epu8({1, 2, 1, 0xFF, 0, 5, 0xFF, 2}, 0))); + REQUIRE( + !is_partial_transformation(Epu8({1, 2, 1, 0xFF, 0, 16, 0xFF, 2}, 0))); +} + +TEST_CASE_METHOD(Fix, "is_transformation", "[Epu8][052]") { + REQUIRE(is_transformation(zero)); + REQUIRE(is_transformation(P01)); + REQUIRE(is_transformation(P10)); + REQUIRE(!is_transformation(Epu8({16}, 0))); + REQUIRE(!is_transformation(Epu8({}, 0xff))); + REQUIRE(!is_transformation(Epu8({2, 0xff, 3}, 0))); + + REQUIRE(!is_transformation(zero, 15)); + REQUIRE(is_transformation(Pa)); + REQUIRE(is_transformation(Pa, 6)); + REQUIRE(is_transformation(Pa, 5)); + REQUIRE(!is_transformation(Pa, 4)); + REQUIRE(!is_transformation(Pa, 1)); + REQUIRE(!is_transformation(Pa, 0)); + + REQUIRE(is_transformation(RP)); + REQUIRE(is_transformation(RP, 16)); + REQUIRE(!is_transformation(RP, 15)); +} + +TEST_CASE_METHOD(Fix, "is_partial_permutation", "[Epu8][053]") { + REQUIRE(!is_partial_permutation(zero)); + REQUIRE(!is_partial_permutation(P01)); + REQUIRE(!is_partial_permutation(P10)); + REQUIRE(!is_partial_permutation(Epu8({16}, 0))); + REQUIRE(is_partial_permutation(Epu8({}, 0xff))); + REQUIRE(!is_partial_permutation(Epu8({2, 0xff, 3}, 0))); + REQUIRE(is_partial_permutation(Epu8({2, 0xff, 3}, 0xff))); + + REQUIRE(!is_partial_permutation(zero, 15)); + REQUIRE(is_partial_permutation(Pa)); + REQUIRE(is_partial_permutation(Pa, 6)); + REQUIRE(is_partial_permutation(Pa, 5)); + REQUIRE(!is_partial_permutation(Pa, 4)); + REQUIRE(!is_partial_permutation(Pa, 1)); + REQUIRE(!is_partial_permutation(Pa, 0)); + + REQUIRE(is_partial_permutation(RP)); + REQUIRE(is_partial_permutation(RP, 16)); + REQUIRE(!is_partial_permutation(RP, 15)); + + REQUIRE(is_partial_permutation( + epu8{1, 2, 0xFF, 0xFF, 0, 5, 0xFF, 3, 8, 9, 10, 11, 12, 13, 14, 15})); + REQUIRE(!is_partial_permutation( + epu8{1, 2, 1, 0xFF, 0, 5, 0xFF, 2, 8, 9, 10, 11, 12, 13, 14, 15})); + REQUIRE(!is_partial_permutation(Epu8({1, 2, 1, 0xFF, 0, 5, 0xFF, 2}, 0))); + REQUIRE(!is_partial_permutation(Epu8({1, 2, 1, 0xFF, 0, 16, 0xFF, 2}, 0))); +} + +TEST_CASE_METHOD(Fix, "is_permutation", "[Epu8][054]") { + REQUIRE(!is_permutation(zero)); + REQUIRE(!is_permutation(P01)); + REQUIRE(!is_permutation(P10)); + REQUIRE(!is_permutation(Epu8({16}, 0))); + REQUIRE(!is_permutation(Epu8({}, 0xff))); + REQUIRE(!is_permutation(Epu8({2, 0xff, 3}, 0))); + + REQUIRE(!is_permutation(zero, 15)); + REQUIRE(is_permutation(Pa)); + REQUIRE(is_permutation(Pa, 6)); + REQUIRE(is_permutation(Pa, 5)); + REQUIRE(!is_permutation(Pa, 4)); + REQUIRE(!is_permutation(Pa, 1)); + REQUIRE(!is_permutation(Pa, 0)); + + REQUIRE(is_permutation(RP)); + REQUIRE(is_permutation(RP, 16)); + REQUIRE(!is_permutation(RP, 15)); +} +} // namespace HPCombi diff --git a/tests/test_main.cpp b/tests/test_main.cpp new file mode 100644 index 00000000..b1673b8f --- /dev/null +++ b/tests/test_main.cpp @@ -0,0 +1,38 @@ +//****************************************************************************// +// Copyright (C) 2023 James D. Mitchell // +// // +// Distributed under the terms of the GNU General Public License (GPL) // +// // +// This code is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // +// General Public License for more details. // +// // +// The full text of the GPL is available at: // +// // +// http://www.gnu.org/licenses/ // +//****************************************************************************// + +#include + +#include +#include +#include + +struct HPCombiListener : Catch::EventListenerBase { + using EventListenerBase::EventListenerBase; // inherit constructor + + void testCaseStarting(Catch::TestCaseInfo const &testInfo) override { + std::cout << testInfo.tagsAsString() << " " << testInfo.name + << std::endl; + } + void testCaseEnded(Catch::TestCaseStats const &testInfo) override {} + void sectionStarting(Catch::SectionInfo const §ionStats) override {} + void sectionEnded(Catch::SectionStats const §ionStats) override {} + void testCasePartialStarting(Catch::TestCaseInfo const &testInfo, + uint64_t partNumber) override {} + void testCasePartialEnded(Catch::TestCaseStats const &testCaseStats, + uint64_t partNumber) override {} +}; + +CATCH_REGISTER_LISTENER(HPCombiListener) diff --git a/tests/test_main.hpp b/tests/test_main.hpp new file mode 100644 index 00000000..6328ba80 --- /dev/null +++ b/tests/test_main.hpp @@ -0,0 +1,42 @@ +//****************************************************************************// +// Copyright (C) 2023 James D. Mitchell // +// // +// Distributed under the terms of the GNU General Public License (GPL) // +// // +// This code is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // +// General Public License for more details. // +// // +// The full text of the GPL is available at: // +// // +// http://www.gnu.org/licenses/ // +//****************************************************************************// + +#ifndef HPCOMBI_TESTS_TEST_MAIN_HPP_ +#define HPCOMBI_TESTS_TEST_MAIN_HPP_ + +#define TEST_AGREES(fixture, type, ref, fun, vct, tags) \ + TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \ + for (type p : vct) { \ + REQUIRE(p.fun() == p.ref()); \ + } \ + } + +#define TEST_AGREES2(fixture, type, ref, fun, vct, tags) \ + TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \ + for (type p1 : vct) { \ + for (type p2 : vct) { \ + REQUIRE(p1.fun(p2) == p1.ref(p2)); \ + } \ + } \ + } + +#define TEST_AGREES_EPU8(fixture, type, ref, fun, vct, tags) \ + TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \ + for (type p : vct) { \ + REQUIRE(equal(p.fun(), p.ref())); \ + } \ + } + +#endif // HPCOMBI_TESTS_TEST_MAIN_HPP_ diff --git a/tests/test_perm16.cpp b/tests/test_perm16.cpp index a976887d..9acea11c 100644 --- a/tests/test_perm16.cpp +++ b/tests/test_perm16.cpp @@ -13,51 +13,29 @@ /* http://www.gnu.org/licenses/ */ /******************************************************************************/ -#define BOOST_TEST_MODULE Perm16Tests - #include "perm16.hpp" -#include - -using HPCombi::epu8; -using HPCombi::equal; -using HPCombi::Epu8; -using HPCombi::is_partial_transformation; -using HPCombi::is_transformation; -using HPCombi::is_permutation; -using HPCombi::PTransf16; -using HPCombi::Transf16; -using HPCombi::PPerm16; -using HPCombi::Perm16; +#include "test_main.hpp" +#include +namespace HPCombi { const uint8_t FF = 0xff; -#define EPU8_EQUAL(p1, p2) BOOST_CHECK_PREDICATE(equal, (p1)(p2)) -#define EPU8_NOT_EQUAL(p1, p2) BOOST_CHECK_PREDICATE(boost::not2(equal), (p1)(p2)) - -#define TEST_AGREES(type, ref, fun, vct) \ - BOOST_FIXTURE_TEST_CASE(type##_agrees_##fun, Fix) { \ - for (type p : vct) BOOST_TEST(p.fun() == p.ref()); \ - } -#define TEST_EPU8_AGREES(type, ref, fun, vct) \ - BOOST_FIXTURE_TEST_CASE(type##_agrees_##fun, Fix) { \ - for (type p : vct) EPU8_EQUAL(p.fun(), p.ref()); \ - } - -std::vector all_perms(uint8_t sz){ - std::vector res {}; +namespace { +std::vector all_perms(uint8_t sz) { + std::vector res{}; epu8 x = HPCombi::epu8id; res.push_back(x); - auto & refx = HPCombi::as_array(x); - while (std::next_permutation(refx.begin(), refx.begin()+sz)) { + auto &refx = HPCombi::as_array(x); + while (std::next_permutation(refx.begin(), refx.begin() + sz)) { res.push_back(x); } return res; }; std::vector all_pperms(std::vector perms, - std::vector masks){ - std::vector res {}; + std::vector masks) { + std::vector res{}; for (epu8 mask : masks) { for (Perm16 p : perms) { res.push_back(p.v | mask); @@ -66,28 +44,21 @@ std::vector all_pperms(std::vector perms, return res; } -struct Fix { - Fix() : zero(Epu8({}, 0)), - P01(Epu8({0, 1}, 0)), - P10(Epu8({1, 0}, 0)), - P11(Epu8({1, 1}, 0)), - P1(Epu8({}, 1)), - RandT({3, 1, 0, 14, 15, 13, 5, 10, 2, 11, 6, 12, 7, 4, 8, 9}), - PPa({1, 2, 3, 4, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), - PPb({1, 2, 3, 6, 0, 5, 4, 7, 8, 9, 10, 11, 12, 15, 14, 13}), - RandPerm(RandT), - Tlist({zero, P01, P10, P11, P1, RandT, epu8(PPa), epu8(PPb)}), - PlistSmall(all_perms(6)), Plist(all_perms(9)), - PPmasks({ - Epu8(0), Epu8(FF), Epu8({0}, FF), Epu8({0, 0}, FF), - Epu8({0, FF, 0}, FF), Epu8({0, FF, 0}, 0), - Epu8({0, FF, 0, FF, 0, 0, 0, FF, FF}, 0) - }), - PPlist(all_pperms(PlistSmall, PPmasks)) - { - BOOST_TEST_MESSAGE("setup fixture"); - } - ~Fix() { BOOST_TEST_MESSAGE("teardown fixture"); } +struct Perm16Fixture { + Perm16Fixture() + : zero(Epu8({}, 0)), P01(Epu8({0, 1}, 0)), P10(Epu8({1, 0}, 0)), + P11(Epu8({1, 1}, 0)), P1(Epu8({}, 1)), + RandT({3, 1, 0, 14, 15, 13, 5, 10, 2, 11, 6, 12, 7, 4, 8, 9}), + PPa({1, 2, 3, 4, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), + PPb({1, 2, 3, 6, 0, 5, 4, 7, 8, 9, 10, 11, 12, 15, 14, 13}), + RandPerm(RandT), + Tlist({zero, P01, P10, P11, P1, RandT, epu8(PPa), epu8(PPb)}), + PlistSmall(all_perms(6)), Plist(all_perms(9)), + PPmasks({Epu8(0), Epu8(FF), Epu8({0}, FF), Epu8({0, 0}, FF), + Epu8({0, FF, 0}, FF), Epu8({0, FF, 0}, 0), + Epu8({0, FF, 0, FF, 0, 0, 0, FF, FF}, 0)}), + PPlist(all_pperms(PlistSmall, PPmasks)) {} + ~Perm16Fixture() = default; const Transf16 zero, P01, P10, P11, P1, RandT; const Perm16 PPa, PPb, RandPerm; @@ -96,424 +67,442 @@ struct Fix { const std::vector PPmasks; const std::vector PPlist; }; +} // namespace - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(PTransf16_test) -//****************************************************************************// - -BOOST_AUTO_TEST_CASE(PTransf16_constructor) { +TEST_CASE("PTransf16::PTransf16", "[PTransf16][000]") { const uint8_t FF = 0xff; - BOOST_TEST(PTransf16({}) == PTransf16::one()); - BOOST_TEST(PTransf16({0,1,2,3}) == PTransf16::one()); - BOOST_TEST(PTransf16({1,0}) == PTransf16({1,0,2})); - BOOST_TEST(PTransf16({2}) == PTransf16({2,1,2})); - BOOST_TEST(PTransf16({4, 5, 0}, {9, 0, 1}) == - PTransf16({ 1,FF,FF,FF, 9, 0,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF})); - BOOST_TEST(PTransf16({4, 5, 0, 8}, {9, 0, 1, 2}) == - PTransf16({ 1,FF,FF,FF, 9, 0,FF,FF,2,FF,FF,FF,FF,FF,FF,FF})); - BOOST_TEST(PTransf16({4, 5, 0, 8}, {9, 0, 2, 2}) == - PTransf16({ 2,FF,FF,FF, 9, 0,FF,FF,2,FF,FF,FF,FF,FF,FF,FF})); -} - - -BOOST_AUTO_TEST_CASE(PTransf16_hash) { - BOOST_TEST(std::hash()(PTransf16::one()) != 0); - BOOST_TEST(std::hash()(PTransf16(Epu8(1))) != 0); - BOOST_TEST(std::hash()(PTransf16({4, 5, 0}, {9, 0, 1})) != 0); -} - - -BOOST_AUTO_TEST_CASE(PTransf16_image_mask) { - EPU8_EQUAL(PTransf16({}).image_mask(), Epu8(FF)); - EPU8_EQUAL(PTransf16({}).image_mask(false), Epu8(FF)); - EPU8_EQUAL(PTransf16({}).image_mask(true), Epu8(0)); - EPU8_EQUAL(PTransf16({4,4,4,4}).image_mask(), Epu8({0,0,0,0}, FF)); - EPU8_EQUAL(PTransf16({4,4,4,4}).image_mask(false), Epu8({0,0,0,0}, FF)); - EPU8_EQUAL(PTransf16({4,4,4,4}).image_mask(true), Epu8({FF,FF,FF,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8(1)).image_mask(), Epu8({0,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8(2)).image_mask(), Epu8({0,0,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8({2,2,2,0xf},2)).image_mask(), - Epu8({0,0,FF,0,0,0,0,0,0,0,0,0,0,0,0,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,5,2}, 2)).image_mask(), - Epu8({FF,0,FF,0,0,FF,0,0,0,0,0,0,0,0,0,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,5,2}, 2)).image_mask(false), - Epu8({FF,0,FF,0,0,FF,0,0,0,0,0,0,0,0,0,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,5,2}, 2)).image_mask(true), - Epu8({0,FF,0,FF,FF,0,FF,FF,FF,FF,FF,FF,FF,FF,FF,0}, 0)); -} - -BOOST_AUTO_TEST_CASE(PTransf16_left_one) { - BOOST_TEST(PTransf16({}).left_one() == PTransf16::one()); - BOOST_TEST(PTransf16({4,4,4,4}).left_one() == PTransf16({FF,FF,FF,FF})); - BOOST_TEST(PTransf16(Epu8(1)).left_one() == PTransf16(Epu8({FF,1}, FF))); - BOOST_TEST(PTransf16(Epu8(2)).left_one() == PTransf16(Epu8({FF,FF,2}, FF))); - BOOST_TEST(PTransf16(Epu8({2,2,2,0xf},2)).left_one() == - PTransf16({FF,FF,2,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,15})); - BOOST_TEST(PTransf16(Epu8({FF,2,2,0xf},FF)).left_one() == - PTransf16({FF,FF,2,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,15})); - BOOST_TEST(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,5,2}, 2)).left_one() == - PTransf16({0,FF,2,FF,FF,5,FF,FF,FF,FF,FF,FF,FF,FF,FF,15})); - BOOST_TEST(PTransf16(Epu8({0,2,FF,0xf,2,FF,2,FF,5}, FF)).left_one() == - PTransf16({0,FF,2,FF,FF,5,FF,FF,FF,FF,FF,FF,FF,FF,FF,15})); -} - -BOOST_AUTO_TEST_CASE(PTransf16_domain_mask) { - EPU8_EQUAL(PTransf16({}).domain_mask(), Epu8(FF)); - EPU8_EQUAL(PTransf16({4,4,4,4}).domain_mask(), Epu8(FF)); - EPU8_EQUAL(PTransf16({4,4,4,4}).domain_mask(false), Epu8(FF)); - EPU8_EQUAL(PTransf16({4,4,4,4}).domain_mask(true), Epu8(0)); - EPU8_EQUAL(PTransf16(Epu8(1)).domain_mask(), Epu8(FF)); - EPU8_EQUAL(PTransf16(Epu8(2)).domain_mask(), Epu8(FF)); - EPU8_EQUAL(PTransf16(Epu8({2,2,2,0xf}, FF)).domain_mask(), - Epu8({FF,FF,FF,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8({FF,2,2,0xf},FF)).domain_mask(), - Epu8({0, FF, FF, FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,FF,0xf,2,FF,2,FF,5}, FF)).domain_mask(), - Epu8({FF,FF,0,FF,FF,0,FF,0,FF},0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,FF,0xf,2,FF,2,FF,5}, FF)).domain_mask(false), - Epu8({FF,FF,0,FF,FF,0,FF,0,FF},0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,FF,0xf,2,FF,2,FF,5}, FF)).domain_mask(true), - Epu8({0,0,FF,0,0,FF, 0,FF,0},FF)); -} - -BOOST_AUTO_TEST_CASE(PTransf16_right_one) { - BOOST_TEST(PTransf16({}).right_one() == PTransf16::one()); - BOOST_TEST(PTransf16({4,4,4,4}).right_one() == PTransf16::one()); - BOOST_TEST(PTransf16(Epu8(1)).right_one() == PTransf16::one()); - BOOST_TEST(PTransf16(Epu8(2)).right_one() == PTransf16::one()); - BOOST_TEST(PTransf16(Epu8({2,2,2,0xf}, FF)).right_one() == - PTransf16(Epu8({0,1,2,3}, FF))); - BOOST_TEST(PTransf16(Epu8({FF,2,2,0xf},FF)).right_one() == - PTransf16({FF, 1, 2, 3,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF})); - BOOST_TEST(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,5,2}, 2)).right_one() == - PTransf16::one()); - BOOST_TEST(PTransf16(Epu8({0,2,FF,0xf,2,FF,2,FF,5}, FF)).right_one() == - PTransf16({0,1,FF,3,4,FF, 6,FF,8,FF,FF,FF,FF,FF,FF,FF})); -} - - -BOOST_AUTO_TEST_CASE(PTransf16_rank_ref) { - BOOST_TEST(PTransf16({}).rank_ref() == 16); - BOOST_TEST(PTransf16({4,4,4,4}).rank() == 12); - BOOST_TEST(PTransf16({1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}).rank_ref() == 1); - BOOST_TEST(PTransf16({2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}).rank_ref() == 1); - BOOST_TEST(PTransf16({2,2,2,0xf,2,2,2,2,2,2,2,2,2,2,2,2}).rank_ref() == 2); - BOOST_TEST(PTransf16({0,2,2,0xf,2,2,2,2,5,2,2,2,2,2,2,2}).rank_ref() == 4); - BOOST_TEST(PTransf16({1,1,1,FF,1,1,FF,1,1,FF,1,FF,1,1,1,1}).rank_ref() == 1); - BOOST_TEST(PTransf16({2,2,2,2,2,FF,2,2,2,FF,2,2,2,FF,2,2}).rank_ref() == 1); - BOOST_TEST(PTransf16({2,2,2,0xf,2,FF,2,2,2,2,2,2,2,2,2,2}).rank_ref() == 2); - BOOST_TEST(PTransf16({0,2,2,0xf,2,2,FF,2,5,2,FF,2,2,2,2,2}).rank_ref() == 4); -} - -BOOST_AUTO_TEST_CASE(PTransf16_rank) { - BOOST_TEST(PTransf16({}).rank() == 16); - BOOST_TEST(PTransf16({4,4,4,4}).rank() == 12); - BOOST_TEST(PTransf16({1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}).rank() == 1); - BOOST_TEST(PTransf16({2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}).rank() == 1); - BOOST_TEST(PTransf16({2,2,2,0xf,2,2,2,2,2,2,2,2,2,2,2,2}).rank() == 2); - BOOST_TEST(PTransf16({0,2,2,0xf,2,2,2,2,5,2,2,2,2,2,2,2}).rank() == 4); -} - -BOOST_AUTO_TEST_CASE(PTransf16_fix_points_mask) { - EPU8_EQUAL(PTransf16({}).fix_points_mask(), Epu8(FF)); - EPU8_EQUAL(PTransf16({}).fix_points_mask(false), Epu8(FF)); - EPU8_EQUAL(PTransf16({}).fix_points_mask(true), Epu8(0)); - EPU8_EQUAL(PTransf16({4,4,4,4}).fix_points_mask(), Epu8({0,0,0,0}, FF)); - EPU8_EQUAL(PTransf16({4,4,4,4}).fix_points_mask(false), Epu8({0,0,0,0}, FF)); - EPU8_EQUAL(PTransf16({4,4,4,4}).fix_points_mask(true), Epu8({FF,FF,FF,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8(1)).fix_points_mask(), Epu8({0,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8(2)).fix_points_mask(), Epu8({0,0,FF}, 0)); - EPU8_EQUAL(PTransf16(Epu8({2,2,2,0xf},7)).fix_points_mask(), - Epu8({0,0,FF,0,0,0,0,FF,0,0,0,0,0,0,0,0}, 0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,2,0xf,2,2,2,14,5,2}, 2)).fix_points_mask(), - Epu8({FF,0,FF,0,0,0,0,0,0,0,0,0,0,0,0,0}, 0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,8,2}, 14)).fix_points_mask(false), - Epu8({FF,0,FF,0,0,0,0,0,FF,0,0,0,0,0,FF,0}, 0)); - EPU8_EQUAL(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,5,2}, 2)).fix_points_mask(true), - Epu8({0,FF,0},FF)); -} -BOOST_AUTO_TEST_CASE(PTransf16_fix_points_bitset) { - BOOST_TEST(PTransf16({}).fix_points_bitset() == 0xFFFF); - BOOST_TEST(PTransf16({}).fix_points_bitset(false) == 0xFFFF); - BOOST_TEST(PTransf16({}).fix_points_bitset(true) == 0); - BOOST_TEST(PTransf16({4,4,4,4}).fix_points_bitset() == 0xFFF0); - BOOST_TEST(PTransf16({4,4,4,4}).fix_points_bitset(false) == 0xFFF0); - BOOST_TEST(PTransf16({4,4,4,4}).fix_points_bitset(true) == 0x000F); - BOOST_TEST(PTransf16(Epu8(1)).fix_points_bitset() == 0x0002); - BOOST_TEST(PTransf16(Epu8(2)).fix_points_bitset() == 0x0004); - BOOST_TEST(PTransf16(Epu8({2,2,2,0xf},7)).fix_points_bitset() == 0x0084); - BOOST_TEST(PTransf16(Epu8({0,2,2,0xf,2,2,2,14,5,2}, 2)).fix_points_bitset() - == 0x5); - BOOST_TEST(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,8,2}, 14)).fix_points_bitset(false) - == 0x4105); - BOOST_TEST(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,5,2}, 2)).fix_points_bitset(true) - == 0xFFFA); -} -BOOST_AUTO_TEST_CASE(PTransf16_nb_fix_points) { - BOOST_TEST(PTransf16({}).nb_fix_points() == 16); - BOOST_TEST(PTransf16({4,4,4,4}).nb_fix_points() == 12); - BOOST_TEST(PTransf16(Epu8(1)).nb_fix_points() == 1); - BOOST_TEST(PTransf16(Epu8(2)).nb_fix_points() == 1); - BOOST_TEST(PTransf16(Epu8({2,2,2,0xf},7)).nb_fix_points() == 2); - BOOST_TEST(PTransf16(Epu8({0,2,2,0xf,2,2,2,14,5,2}, 2)).nb_fix_points() - == 2); - BOOST_TEST(PTransf16(Epu8({0,2,2,0xf,2,2,2,2,8,2}, 14)).nb_fix_points() - == 4); - -} - -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(Transf16_test) -//****************************************************************************// - -BOOST_FIXTURE_TEST_CASE(Transf16OperatorUInt64, Fix) { - BOOST_TEST(static_cast(Transf16::one()) == 0xf7e6d5c4b3a29180); - BOOST_TEST(static_cast(zero) == 0x0); - BOOST_TEST(static_cast(P10) == 0x1); - BOOST_TEST(static_cast(P01) == 0x100); - BOOST_TEST(static_cast(P11) == 0x101); - BOOST_TEST(static_cast(P1) == 0x1111111111111111); - BOOST_TEST(static_cast(RandT) == 0x9a854d7fce60b123); -} - -BOOST_FIXTURE_TEST_CASE(Transf16ConstrUInt64, Fix) { - BOOST_TEST(static_cast(0x0) == zero); - BOOST_TEST(static_cast(0x1) == P10); - BOOST_TEST(static_cast(0x100) == P01); - for (auto p : Tlist) - BOOST_TEST(static_cast(static_cast(p)) == p); + REQUIRE(PTransf16({}) == PTransf16::one()); + REQUIRE(PTransf16({0, 1, 2, 3}) == PTransf16::one()); + REQUIRE(PTransf16({1, 0}) == PTransf16({1, 0, 2})); + REQUIRE(PTransf16({2}) == PTransf16({2, 1, 2})); + REQUIRE(PTransf16({4, 5, 0}, {9, 0, 1}) == + PTransf16( + {1, FF, FF, FF, 9, 0, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF})); + REQUIRE(PTransf16({4, 5, 0, 8}, {9, 0, 1, 2}) == + PTransf16( + {1, FF, FF, FF, 9, 0, FF, FF, 2, FF, FF, FF, FF, FF, FF, FF})); + REQUIRE(PTransf16({4, 5, 0, 8}, {9, 0, 2, 2}) == + PTransf16( + {2, FF, FF, FF, 9, 0, FF, FF, 2, FF, FF, FF, FF, FF, FF, FF})); +} + +TEST_CASE("PTransf16::hash", "[PTransf16][001]") { + REQUIRE(std::hash()(PTransf16::one()) != 0); + REQUIRE(std::hash()(PTransf16(Epu8(1))) != 0); + REQUIRE(std::hash()(PTransf16({4, 5, 0}, {9, 0, 1})) != 0); +} + +// TODO uncomment +// TEST_CASE("PTransf16::image_mask", "[PTransf16][002]") { +// REQUIRE(equal(PTransf16({}).image_mask(), Epu8(FF)); +// REQUIRE(equal(PTransf16({}).image_mask(false), Epu8(FF)); +// REQUIRE(equal(PTransf16({}).image_mask(true), Epu8(0)); +// REQUIRE(equal(PTransf16({4, 4, 4, 4}).image_mask(), Epu8({0, 0, 0, 0}, +// FF)); REQUIRE(equal(PTransf16({4, 4, 4, 4}).image_mask(false), +// Epu8({0, 0, 0, 0}, FF)); +// REQUIRE(equal(PTransf16({4, 4, 4, 4}).image_mask(true), +// Epu8({FF, FF, FF, FF}, 0)); +// REQUIRE(equal(PTransf16(Epu8(1)).image_mask(), Epu8({0, FF}, 0)); +// REQUIRE(equal(PTransf16(Epu8(2)).image_mask(), Epu8({0, 0, FF}, 0)); +// REQUIRE(equal(PTransf16(Epu8({2, 2, 2, 0xf}, 2)).image_mask(), +// Epu8({0, 0, FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FF}, 0)); +// REQUIRE(equal( +// PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2)).image_mask(), +// Epu8({FF, 0, FF, 0, 0, FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, FF}, 0)); +// REQUIRE(equal( +// PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, +// 2)).image_mask(false), Epu8({FF, 0, FF, 0, 0, FF, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, FF}, 0)); +// REQUIRE(equal( +// PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, +// 2)).image_mask(true), Epu8({0, FF, 0, FF, FF, 0, FF, FF, FF, FF, FF, +// FF, FF, FF, FF, 0}, 0)); +// } + +// TODO uncomment +// TEST_CASE("PTransf16::left_one", "[PTransf16][003]") { +// REQUIRE(PTransf16({}).left_one() == PTransf16::one()); +// REQUIRE(PTransf16({4, 4, 4, 4}).left_one() == +// PTransf16({FF, FF, FF, FF})); +// REQUIRE(PTransf16(Epu8(1)).left_one() == PTransf16(Epu8({FF, 1}, +// FF))); REQUIRE(PTransf16(Epu8(2)).left_one() == +// PTransf16(Epu8({FF, FF, 2}, FF))); +// REQUIRE(PTransf16(Epu8({2, 2, 2, 0xf}, 2)).left_one() == +// PTransf16({FF, FF, 2, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF, +// FF, +// FF, 15})); +// REQUIRE(PTransf16(Epu8({FF, 2, 2, 0xf}, FF)).left_one() == +// PTransf16({FF, FF, 2, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF, +// FF, +// FF, 15})); +// REQUIRE( +// PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2)).left_one() == +// PTransf16( +// {0, FF, 2, FF, FF, 5, FF, FF, FF, FF, FF, FF, FF, FF, FF, 15 })); +// REQUIRE( +// PTransf16(Epu8({0, 2, FF, 0xf, 2, FF, 2, FF, 5}, FF)).left_one() == +// PTransf16( +// {0, FF, 2, FF, FF, 5, FF, FF, FF, FF, FF, FF, FF, FF, FF, 15 })); +// } + +TEST_CASE("PTransf16::domain_mask", "[PTransf16][004]") { + REQUIRE(equal(PTransf16({}).domain_mask(), Epu8(FF))); + REQUIRE(equal(PTransf16({4, 4, 4, 4}).domain_mask(), Epu8(FF))); + REQUIRE(equal(PTransf16({4, 4, 4, 4}).domain_mask(false), Epu8(FF))); + REQUIRE(equal(PTransf16({4, 4, 4, 4}).domain_mask(true), Epu8(0))); + REQUIRE(equal(PTransf16(Epu8(1)).domain_mask(), Epu8(FF))); + REQUIRE(equal(PTransf16(Epu8(2)).domain_mask(), Epu8(FF))); + REQUIRE(equal(PTransf16(Epu8({2, 2, 2, 0xf}, FF)).domain_mask(), + Epu8({FF, FF, FF, FF}, 0))); + REQUIRE(equal(PTransf16(Epu8({FF, 2, 2, 0xf}, FF)).domain_mask(), + Epu8({0, FF, FF, FF}, 0))); + REQUIRE(equal( + PTransf16(Epu8({0, 2, FF, 0xf, 2, FF, 2, FF, 5}, FF)).domain_mask(), + Epu8({FF, FF, 0, FF, FF, 0, FF, 0, FF}, 0))); + REQUIRE(equal(PTransf16(Epu8({0, 2, FF, 0xf, 2, FF, 2, FF, 5}, FF)) + .domain_mask(false), + Epu8({FF, FF, 0, FF, FF, 0, FF, 0, FF}, 0))); + REQUIRE(equal( + PTransf16(Epu8({0, 2, FF, 0xf, 2, FF, 2, FF, 5}, FF)).domain_mask(true), + Epu8({0, 0, FF, 0, 0, FF, 0, FF, 0}, FF))); +} + +TEST_CASE("PTransf16::right_one", "[PTransf16][005]") { + REQUIRE(PTransf16({}).right_one() == PTransf16::one()); + REQUIRE(PTransf16({4, 4, 4, 4}).right_one() == PTransf16::one()); + REQUIRE(PTransf16(Epu8(1)).right_one() == PTransf16::one()); + REQUIRE(PTransf16(Epu8(2)).right_one() == PTransf16::one()); + REQUIRE(PTransf16(Epu8({2, 2, 2, 0xf}, FF)).right_one() == + PTransf16(Epu8({0, 1, 2, 3}, FF))); + REQUIRE(PTransf16(Epu8({FF, 2, 2, 0xf}, FF)).right_one() == + PTransf16( + {FF, 1, 2, 3, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF})); + REQUIRE(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2)).right_one() == + PTransf16::one()); + REQUIRE( + PTransf16(Epu8({0, 2, FF, 0xf, 2, FF, 2, FF, 5}, FF)).right_one() == + PTransf16({0, 1, FF, 3, 4, FF, 6, FF, 8, FF, FF, FF, FF, FF, FF, FF})); +} + +TEST_CASE("PTransf16::rank_ref", "[PTransf16][006]") { + REQUIRE(PTransf16({}).rank_ref() == 16); + REQUIRE(PTransf16({4, 4, 4, 4}).rank_ref() == 12); + REQUIRE(PTransf16({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) + .rank_ref() == 1); + REQUIRE(PTransf16({2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) + .rank_ref() == 1); + REQUIRE(PTransf16({2, 2, 2, 0xf, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) + .rank_ref() == 2); + REQUIRE(PTransf16({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2}) + .rank_ref() == 4); + REQUIRE(PTransf16({1, 1, 1, FF, 1, 1, FF, 1, 1, FF, 1, FF, 1, 1, 1, 1}) + .rank_ref() == 1); + REQUIRE(PTransf16({2, 2, 2, 2, 2, FF, 2, 2, 2, FF, 2, 2, 2, FF, 2, 2}) + .rank_ref() == 1); + REQUIRE(PTransf16({2, 2, 2, 0xf, 2, FF, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) + .rank_ref() == 2); + REQUIRE(PTransf16({0, 2, 2, 0xf, 2, 2, FF, 2, 5, 2, FF, 2, 2, 2, 2, 2}) + .rank_ref() == 4); +} + +// TODO uncomment +// TEST_CASE("PTransf16::rank", "[PTransf16][007]") { +// REQUIRE(PTransf16({}).rank() == 16); +// REQUIRE(PTransf16({4, 4, 4, 4}).rank() == 12); +// REQUIRE( +// PTransf16({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}).rank() == +// 1); +// REQUIRE( +// PTransf16({2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}).rank() == +// 1); +// REQUIRE( +// PTransf16({2, 2, 2, 0xf, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}).rank() +// == 2); +// REQUIRE( +// PTransf16({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2}).rank() +// == 4); +// } + +TEST_CASE("PTransf16::fix_points_mask", "[PTransf16][008]") { + REQUIRE(equal(PTransf16({}).fix_points_mask(), Epu8(FF))); + REQUIRE(equal(PTransf16({}).fix_points_mask(false), Epu8(FF))); + REQUIRE(equal(PTransf16({}).fix_points_mask(true), Epu8(0))); + REQUIRE(equal(PTransf16({4, 4, 4, 4}).fix_points_mask(), + Epu8({0, 0, 0, 0}, FF))); + REQUIRE(equal(PTransf16({4, 4, 4, 4}).fix_points_mask(false), + Epu8({0, 0, 0, 0}, FF))); + REQUIRE(equal(PTransf16({4, 4, 4, 4}).fix_points_mask(true), + Epu8({FF, FF, FF, FF}, 0))); + REQUIRE(equal(PTransf16(Epu8(1)).fix_points_mask(), Epu8({0, FF}, 0))); + REQUIRE(equal(PTransf16(Epu8(2)).fix_points_mask(), Epu8({0, 0, FF}, 0))); + REQUIRE(equal(PTransf16(Epu8({2, 2, 2, 0xf}, 7)).fix_points_mask(), + Epu8({0, 0, FF, 0, 0, 0, 0, FF, 0, 0, 0, 0, 0, 0, 0, 0}, 0))); + REQUIRE(equal( + PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 14, 5, 2}, 2)).fix_points_mask(), + Epu8({FF, 0, FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0))); + REQUIRE( + equal(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 8, 2}, 14)) + .fix_points_mask(false), + Epu8({FF, 0, FF, 0, 0, 0, 0, 0, FF, 0, 0, 0, 0, 0, FF, 0}, 0))); + REQUIRE(equal(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2)) + .fix_points_mask(true), + Epu8({0, FF, 0}, FF))); +} + +TEST_CASE("PTransf16::fix_points_bitset", "[PTransf16][009]") { + REQUIRE(PTransf16({}).fix_points_bitset() == 0xFFFF); + REQUIRE(PTransf16({}).fix_points_bitset(false) == 0xFFFF); + REQUIRE(PTransf16({}).fix_points_bitset(true) == 0); + REQUIRE(PTransf16({4, 4, 4, 4}).fix_points_bitset() == 0xFFF0); + REQUIRE(PTransf16({4, 4, 4, 4}).fix_points_bitset(false) == 0xFFF0); + REQUIRE(PTransf16({4, 4, 4, 4}).fix_points_bitset(true) == 0x000F); + REQUIRE(PTransf16(Epu8(1)).fix_points_bitset() == 0x0002); + REQUIRE(PTransf16(Epu8(2)).fix_points_bitset() == 0x0004); + REQUIRE(PTransf16(Epu8({2, 2, 2, 0xf}, 7)).fix_points_bitset() == 0x0084); + REQUIRE(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 14, 5, 2}, 2)) + .fix_points_bitset() == 0x5); + REQUIRE(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 8, 2}, 14)) + .fix_points_bitset(false) == 0x4105); + REQUIRE(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2)) + .fix_points_bitset(true) == 0xFFFA); +} + +TEST_CASE("PTransf16::nb_fix_points", "[PTransf16][010]") { + REQUIRE(PTransf16({}).nb_fix_points() == 16); + REQUIRE(PTransf16({4, 4, 4, 4}).nb_fix_points() == 12); + REQUIRE(PTransf16(Epu8(1)).nb_fix_points() == 1); + REQUIRE(PTransf16(Epu8(2)).nb_fix_points() == 1); + REQUIRE(PTransf16(Epu8({2, 2, 2, 0xf}, 7)).nb_fix_points() == 2); + REQUIRE( + PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 14, 5, 2}, 2)).nb_fix_points() == + 2); + REQUIRE( + PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 8, 2}, 14)).nb_fix_points() == + 4); +} + +TEST_CASE_METHOD(Perm16Fixture, "Transf16::operator uint64", + "[Transf16][011]") { + REQUIRE(static_cast(Transf16::one()) == 0xf7e6d5c4b3a29180); + REQUIRE(static_cast(zero) == 0x0); + REQUIRE(static_cast(P10) == 0x1); + REQUIRE(static_cast(P01) == 0x100); + REQUIRE(static_cast(P11) == 0x101); + REQUIRE(static_cast(P1) == 0x1111111111111111); + REQUIRE(static_cast(RandT) == 0x9a854d7fce60b123); +} + +TEST_CASE_METHOD(Perm16Fixture, "Transf16::Transf16(uint64_t)", + "[Transf16][012]") { + REQUIRE(static_cast(0x0) == zero); + REQUIRE(static_cast(0x1) == P10); + REQUIRE(static_cast(0x100) == P01); + for (auto p : Tlist) { + REQUIRE(static_cast(static_cast(p)) == p); + } } -BOOST_FIXTURE_TEST_CASE(Transf16_hash, Fix) { - BOOST_TEST(std::hash()(Transf16::one()) != 0); - BOOST_TEST(std::hash()(Transf16(Epu8(1))) != 0); - BOOST_TEST(std::hash()(RandT) != 0); +TEST_CASE_METHOD(Perm16Fixture, "Transf16::hash", "[Transf16][013]") { + REQUIRE(std::hash()(Transf16::one()) != 0); + REQUIRE(std::hash()(Transf16(Epu8(1))) != 0); + REQUIRE(std::hash()(RandT) != 0); } -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(Perm16_constr) -//****************************************************************************// - -BOOST_FIXTURE_TEST_CASE(Perm16OperatorUInt64, Fix) { - BOOST_TEST(static_cast(Perm16::one()) == 0xf7e6d5c4b3a29180); - BOOST_TEST(static_cast(PPa) == 0xf7e6d5c0b4a39281); - BOOST_TEST(static_cast(PPb) == 0xd7e4f5c0b6a39281); - BOOST_TEST(static_cast(RandPerm) == 0x9a854d7fce60b123); +TEST_CASE_METHOD(Perm16Fixture, "Perm16::operator uint64_t", "[Perm16][014]") { + REQUIRE(static_cast(Perm16::one()) == 0xf7e6d5c4b3a29180); + REQUIRE(static_cast(PPa) == 0xf7e6d5c0b4a39281); + REQUIRE(static_cast(PPb) == 0xd7e4f5c0b6a39281); + REQUIRE(static_cast(RandPerm) == 0x9a854d7fce60b123); - for (auto p : { Perm16::one(), PPa, PPb, RandPerm }) - BOOST_TEST(static_cast(static_cast(p)) == p); + for (auto p : {Perm16::one(), PPa, PPb, RandPerm}) { + REQUIRE(static_cast(static_cast(p)) == p); + } } - -BOOST_AUTO_TEST_CASE(Perm16TestEq) { - BOOST_TEST(Perm16::one() * Perm16::one() == Perm16::one()); +TEST_CASE("Perm::operator==", "[Perm16][015]") { + REQUIRE(Perm16::one() * Perm16::one() == Perm16::one()); } -BOOST_FIXTURE_TEST_CASE(Perm16_hash, Fix) { - BOOST_TEST(std::hash()(Transf16::one()) != 0); - BOOST_TEST(std::hash()(PPa) != 0); - BOOST_TEST(std::hash()(RandPerm) != 0); +TEST_CASE_METHOD(Perm16Fixture, "Perm16::hash", "[Perm16][016]") { + REQUIRE(std::hash()(Transf16::one()) != 0); + REQUIRE(std::hash()(PPa) != 0); + REQUIRE(std::hash()(RandPerm) != 0); } -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - - -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(PPerm16_test) -//****************************************************************************// - -BOOST_AUTO_TEST_CASE(PPerm16_constructor) { +TEST_CASE("PPerm16::PPerm16", "[PPerm16][017]") { const uint8_t FF = 0xff; - BOOST_TEST(PPerm16({4, 5, 0}, {9, 0, 1}) == - PPerm16({ 1,FF,FF,FF, 9, 0,FF,FF,FF,FF,FF,FF,FF,FF,FF,FF})); - BOOST_TEST(PPerm16({4, 5, 0, 8}, {9, 0, 1, 2}) == - PPerm16({ 1,FF,FF,FF, 9, 0,FF,FF,2,FF,FF,FF,FF,FF,FF,FF})); -} - -BOOST_AUTO_TEST_CASE(PPerm16_hash) { - BOOST_TEST(std::hash()(PPerm16::one()) != 0); - BOOST_TEST(std::hash()(PPerm16({4, 5, 0}, {9, 0, 1})) != 0); -} - - -BOOST_FIXTURE_TEST_CASE(PPerm16_left_one, Fix) { - BOOST_TEST(PPerm16({}).left_one() == PPerm16::one()); - BOOST_TEST(PPerm16({FF,FF,FF,4}).left_one() == PPerm16({FF,FF,FF,FF})); - BOOST_TEST(PPerm16({FF,4,FF,FF}).left_one() == PPerm16({FF,FF,FF,FF})); + REQUIRE( + PPerm16({4, 5, 0}, {9, 0, 1}) == + PPerm16({1, FF, FF, FF, 9, 0, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF})); + REQUIRE( + PPerm16({4, 5, 0, 8}, {9, 0, 1, 2}) == + PPerm16({1, FF, FF, FF, 9, 0, FF, FF, 2, FF, FF, FF, FF, FF, FF, FF})); +} + +TEST_CASE("PPerm16::hash", "[PPerm16][018]") { + REQUIRE(std::hash()(PPerm16::one()) != 0); + REQUIRE(std::hash()(PPerm16({4, 5, 0}, {9, 0, 1})) != 0); +} +// TODO uncomment +// TEST_CASE_METHOD(Perm16Fixture, "PPerm16::left_one", "[PPerm16][019]") { +// REQUIRE(PPerm16({}).left_one() == PPerm16::one()); +// REQUIRE(PPerm16({FF, FF, FF, 4}).left_one() == +// PPerm16({FF, FF, FF, FF})); +// REQUIRE(PPerm16({FF, 4, FF, FF}).left_one() == +// PPerm16({FF, FF, FF, FF})); +// for (auto pp : PPlist) { +// REQUIRE(pp.left_one() * pp == pp); +// } +// } + +TEST_CASE_METHOD(Perm16Fixture, "PPerm16::right_one", "[PPerm16][020]") { + REQUIRE(PPerm16({}).right_one() == PPerm16::one()); + REQUIRE(PPerm16({FF, FF, FF, 4}).right_one() == PPerm16({FF, FF, FF})); + REQUIRE(PPerm16({FF, 4, FF, FF}).right_one() == PPerm16({FF, 1, FF, FF})); for (auto pp : PPlist) { - BOOST_TEST(pp.left_one() * pp == pp); + REQUIRE(pp * pp.right_one() == pp); } } +// TODO uncomment +// TEST_AGREES(Perm16Fixture, PPerm16, inverse_ref, inverse_find, PPlist, +// "[PPerm16][021]"); + +TEST_CASE_METHOD(Perm16Fixture, "Perm16::fix_points_mask", "[PPerm16][022]") { + REQUIRE(equal(PTransf16::one().fix_points_mask(), Epu8(FF))); + REQUIRE(equal(Perm16::one().fix_points_mask(), Epu8(FF))); + REQUIRE(equal(PPa.fix_points_mask(), Epu8({0, 0, 0, 0, 0}, FF))); + REQUIRE(equal(PPb.fix_points_mask(), (epu8{0, 0, 0, 0, 0, FF, 0, FF, FF, FF, + FF, FF, FF, 0, FF, 0}))); + REQUIRE(equal(RandPerm.fix_points_mask(), Epu8({0, FF}, 0))); + + REQUIRE(equal(Perm16::one().fix_points_mask(false), Epu8(FF))); + REQUIRE(equal(PPa.fix_points_mask(false), Epu8({0, 0, 0, 0, 0}, FF))); + REQUIRE( + equal(PPb.fix_points_mask(false), + (epu8{0, 0, 0, 0, 0, FF, 0, FF, FF, FF, FF, FF, FF, 0, FF, 0}))); + REQUIRE(equal(RandPerm.fix_points_mask(false), Epu8({0, FF}, 0))); + + REQUIRE(equal(Perm16::one().fix_points_mask(true), Epu8(0))); + REQUIRE(equal(PPa.fix_points_mask(true), Epu8({FF, FF, FF, FF, FF}, 0))); + REQUIRE(equal(PPb.fix_points_mask(true), (epu8{FF, FF, FF, FF, FF, 0, FF, 0, + 0, 0, 0, 0, 0, FF, 0, FF}))); + REQUIRE(equal(RandPerm.fix_points_mask(true), Epu8({FF, 0}, FF))); +} + +TEST_CASE_METHOD(Perm16Fixture, "Perm16::smallest_fix_point", "[Perm16][023]") { + REQUIRE(Perm16::one().smallest_fix_point() == 0); + REQUIRE(PPa.smallest_fix_point() == 5); + REQUIRE(PPb.smallest_fix_point() == 5); + REQUIRE(RandPerm.smallest_fix_point() == 1); +} + +TEST_CASE_METHOD(Perm16Fixture, "Perm16::smallest_moved_point", + "[Perm16][024]") { + REQUIRE(Perm16::one().smallest_moved_point() == FF); + REQUIRE(PPa.smallest_moved_point() == 0); + REQUIRE(PPb.smallest_moved_point() == 0); + REQUIRE(RandPerm.smallest_moved_point() == 0); + REQUIRE(Perm16({0, 1, 3, 2}).smallest_moved_point() == 2); +} + +// TODO broken test +// TEST_CASE_METHOD(Perm16Fixture, "Perm16::largest_fix_point", "[Perm16][025]") +// { +// REQUIRE(Perm16::one().largest_fix_point() == 15); +// REQUIRE(PPa.largest_fix_point() == 15); +// REQUIRE(PPb.largest_fix_point() == 14); +// REQUIRE(RandPerm.largest_fix_point() == 1); +// } + +TEST_CASE_METHOD(Perm16Fixture, "Perm16::nb_fix_points", "[Perm16][026]") { + REQUIRE(Perm16::one().nb_fix_points() == 16); + REQUIRE(PPa.nb_fix_points() == 11); + REQUIRE(PPb.nb_fix_points() == 8); + REQUIRE(RandPerm.nb_fix_points() == 1); + REQUIRE(Perm16({0, 1, 3, 2}).nb_fix_points() == 14); +} + +TEST_CASE_METHOD(Perm16Fixture, "Perm16::inverse_ref", "[Perm16][027]") { + REQUIRE(PPa * PPa.inverse() == Perm16::one()); + REQUIRE(PPa.inverse() * PPa == Perm16::one()); + REQUIRE(PPb * PPb.inverse() == Perm16::one()); + REQUIRE(PPb.inverse() * PPb == Perm16::one()); + REQUIRE(RandPerm * RandPerm.inverse() == Perm16::one()); + REQUIRE(RandPerm.inverse() * RandPerm == Perm16::one()); -BOOST_FIXTURE_TEST_CASE(PPerm16_right_one, Fix) { - BOOST_TEST(PPerm16({}).right_one() == PPerm16::one()); - BOOST_TEST(PPerm16({FF,FF,FF,4}).right_one() == PPerm16({FF,FF,FF})); - BOOST_TEST(PPerm16({FF,4,FF,FF}).right_one() == PPerm16({FF,1,FF,FF})); - for (auto pp : PPlist) { - BOOST_TEST(pp * pp.right_one() == pp); - } -} - -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(PPerm16_inverse_ref, Fix) { - for (epu8 mask : PPmasks) { - for (Perm16 p : Plist) { - PPerm16 pp (p.v | mask); - PPerm16 pi = pp.inverse_ref(); - BOOST_TEST(pp * pi * pp == pp); - BOOST_TEST(pi * pp * pi == pi); - BOOST_TEST(pp.inverse_ref().inverse_ref() == pp); - } + for (Perm16 p : Plist) { + REQUIRE(p * p.inverse() == Perm16::one()); + REQUIRE(p.inverse() * p == Perm16::one()); } } -TEST_AGREES(PPerm16, inverse_ref, inverse_find, PPlist); - -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// - +// TODO uncomment +// TEST_AGREES(Perm16Fixture, Perm16, inverse_ref, inverse_find, Plist, +// "[Perm16][028]"); +TEST_AGREES(Perm16Fixture, Perm16, inverse_ref, inverse_pow, Plist, + "[Perm16][029]"); +TEST_AGREES(Perm16Fixture, Perm16, inverse_ref, inverse_cycl, Plist, + "[Perm16][030]"); +TEST_AGREES(Perm16Fixture, Perm16, inverse_ref, inverse, Plist, + "[Perm16][031]"); -//****************************************************************************// -BOOST_AUTO_TEST_SUITE(Perm16_mathematical_methods) -//****************************************************************************// - -BOOST_FIXTURE_TEST_CASE(Perm16_fix_points_mask, Fix) { - EPU8_EQUAL(PTransf16::one().fix_points_mask(), Epu8(FF)); - EPU8_EQUAL(Perm16::one().fix_points_mask(), Epu8(FF)); - EPU8_EQUAL(PPa.fix_points_mask(), Epu8({0, 0, 0, 0, 0}, FF)); - EPU8_EQUAL(PPb.fix_points_mask(), - (epu8{ 0, 0, 0, 0, 0,FF, 0,FF,FF,FF,FF,FF,FF, 0,FF, 0})); - EPU8_EQUAL(RandPerm.fix_points_mask(), Epu8({0,FF}, 0)); - - EPU8_EQUAL(Perm16::one().fix_points_mask(false), Epu8(FF)); - EPU8_EQUAL(PPa.fix_points_mask(false), Epu8({0, 0, 0, 0, 0}, FF)); - EPU8_EQUAL(PPb.fix_points_mask(false), - (epu8{ 0, 0, 0, 0, 0,FF, 0,FF,FF,FF,FF,FF,FF, 0,FF, 0})); - EPU8_EQUAL(RandPerm.fix_points_mask(false), Epu8({0,FF}, 0)); - - EPU8_EQUAL(Perm16::one().fix_points_mask(true), Epu8(0)); - EPU8_EQUAL(PPa.fix_points_mask(true), Epu8({FF,FF,FF,FF,FF}, 0)); - EPU8_EQUAL(PPb.fix_points_mask(true), - (epu8{FF,FF,FF,FF,FF, 0,FF, 0, 0, 0, 0, 0, 0,FF, 0,FF})); - EPU8_EQUAL(RandPerm.fix_points_mask(true), Epu8({FF, 0}, FF)); +TEST_CASE_METHOD(Perm16Fixture, "Perm16::lehmer_ref", "[Perm16][032]") { + REQUIRE(equal(Perm16::one().lehmer(), zero)); + REQUIRE(equal(PPa.lehmer(), + (epu8{1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}))); + REQUIRE(equal(PPb.lehmer(), + (epu8{1, 1, 1, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0}))); } -BOOST_FIXTURE_TEST_CASE(Perm16_smallest_fix_point, Fix) { - BOOST_TEST(Perm16::one().smallest_fix_point() == 0); - BOOST_TEST(PPa.smallest_fix_point() == 5); - BOOST_TEST(PPb.smallest_fix_point() == 5); - BOOST_TEST(RandPerm.smallest_fix_point() == 1); -} -BOOST_FIXTURE_TEST_CASE(Perm16_smallest_moved_point, Fix) { - BOOST_TEST(Perm16::one().smallest_moved_point() == FF); - BOOST_TEST(PPa.smallest_moved_point() == 0); - BOOST_TEST(PPb.smallest_moved_point() == 0); - BOOST_TEST(RandPerm.smallest_moved_point() == 0); - BOOST_TEST(Perm16({0,1,3,2}).smallest_moved_point() == 2); -} +TEST_AGREES_EPU8(Perm16Fixture, Perm16, lehmer_ref, lehmer_arr, Plist, + "[Perm16][033]"); +TEST_AGREES_EPU8(Perm16Fixture, Perm16, lehmer_ref, lehmer, Plist, + "[Perm16][034]"); -BOOST_FIXTURE_TEST_CASE(Perm16_largest_fix_point, Fix) { - BOOST_TEST(Perm16::one().largest_fix_point() == 15); - BOOST_TEST(PPa.largest_fix_point() == 15); - BOOST_TEST(PPb.largest_fix_point() == 14); - BOOST_TEST(RandPerm.largest_fix_point() == 1); -} -BOOST_FIXTURE_TEST_CASE(Perm16_nb_fix_points, Fix) { - BOOST_TEST(Perm16::one().nb_fix_points() == 16); - BOOST_TEST(PPa.nb_fix_points() == 11); - BOOST_TEST(PPb.nb_fix_points() == 8); - BOOST_TEST(RandPerm.nb_fix_points() == 1); - BOOST_TEST(Perm16({0,1,3,2}).nb_fix_points() == 14); +TEST_CASE_METHOD(Perm16Fixture, "Perm16::length_ref", "[Perm16][035]") { + REQUIRE(Perm16::one().length() == 0); + REQUIRE(PPa.length() == 4); + REQUIRE(PPb.length() == 10); } -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(Perm16_inverse_ref, Fix) { - BOOST_TEST(PPa * PPa.inverse() == Perm16::one()); - BOOST_TEST(PPa.inverse() * PPa == Perm16::one()); - BOOST_TEST(PPb * PPb.inverse() == Perm16::one()); - BOOST_TEST(PPb.inverse() * PPb == Perm16::one()); - BOOST_TEST(RandPerm * RandPerm.inverse() == Perm16::one()); - BOOST_TEST(RandPerm.inverse() * RandPerm == Perm16::one()); +TEST_AGREES(Perm16Fixture, Perm16, length_ref, length_arr, Plist, + "[Perm16][036]"); +TEST_AGREES(Perm16Fixture, Perm16, length_ref, length, Plist, "[Perm16][037]"); - for (Perm16 p : Plist) { - BOOST_TEST(p * p.inverse() == Perm16::one()); - BOOST_TEST(p.inverse() * p == Perm16::one()); - } -} -TEST_AGREES(Perm16, inverse_ref, inverse_arr, Plist); -TEST_AGREES(Perm16, inverse_ref, inverse_sort, Plist); -TEST_AGREES(Perm16, inverse_ref, inverse_find, Plist); -TEST_AGREES(Perm16, inverse_ref, inverse_pow, Plist); -TEST_AGREES(Perm16, inverse_ref, inverse_cycl, Plist); -TEST_AGREES(Perm16, inverse_ref, inverse, Plist); - - -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(Perm16_lehmer_ref, Fix) { - EPU8_EQUAL(Perm16::one().lehmer(), zero); - EPU8_EQUAL(PPa.lehmer(), - (epu8 { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})); - EPU8_EQUAL(PPb.lehmer(), - (epu8 { 1, 1, 1, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0})); +TEST_CASE_METHOD(Perm16Fixture, "Perm16::nb_descents_ref", "[Perm16][038]") { + REQUIRE(Perm16::one().nb_descents_ref() == 0); + REQUIRE(PPa.nb_descents_ref() == 1); + REQUIRE(PPb.nb_descents_ref() == 4); + REQUIRE(Perm16::one().nb_descents() == 0); } -TEST_EPU8_AGREES(Perm16, lehmer_ref, lehmer_arr, Plist); -TEST_EPU8_AGREES(Perm16, lehmer_ref, lehmer, Plist); - -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(Perm16_length_ref, Fix) { - BOOST_TEST(Perm16::one().length() == 0); - BOOST_TEST(PPa.length() == 4); - BOOST_TEST(PPb.length() == 10); -} -TEST_AGREES(Perm16, length_ref, length_arr, Plist); -TEST_AGREES(Perm16, length_ref, length, Plist); - -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(Perm16_nb_descents_ref, Fix) { - BOOST_TEST(Perm16::one().nb_descents_ref() == 0); - BOOST_TEST(PPa.nb_descents_ref() == 1); - BOOST_TEST(PPb.nb_descents_ref() == 4); - BOOST_TEST(Perm16::one().nb_descents() == 0); -} -TEST_AGREES(Perm16, nb_descents_ref, nb_descents, Plist); -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(Perm16_nb_cycles_ref, Fix) { - BOOST_TEST(Perm16::one().nb_cycles_ref() == 16); - BOOST_TEST(PPa.nb_cycles_ref() == 12); - BOOST_TEST(PPb.nb_cycles_ref() == 10); +TEST_AGREES(Perm16Fixture, Perm16, nb_descents_ref, nb_descents, Plist, + "[Perm16][039]"); + +TEST_CASE_METHOD(Perm16Fixture, "Perm16::nb_cycles_ref", "[Perm16][040]") { + REQUIRE(Perm16::one().nb_cycles_ref() == 16); + REQUIRE(PPa.nb_cycles_ref() == 12); + REQUIRE(PPb.nb_cycles_ref() == 10); } -TEST_AGREES(Perm16, nb_cycles_ref, nb_cycles, Plist); +TEST_AGREES(Perm16Fixture, Perm16, nb_cycles_ref, nb_cycles, Plist, + "[Perm16][041]"); -//****************************************************************************// -BOOST_FIXTURE_TEST_CASE(Perm16_left_weak_leq_ref, Fix) { - BOOST_TEST(Perm16::one().left_weak_leq_ref(Perm16::one())); - BOOST_TEST(Perm16::one().left_weak_leq_ref(PPa)); - BOOST_TEST(Perm16::one().left_weak_leq_ref(PPb)); - BOOST_TEST(PPa.left_weak_leq_ref(PPa)); - BOOST_TEST(PPb.left_weak_leq_ref(PPb)); +TEST_CASE_METHOD(Perm16Fixture, "Perm16::left_weak_leq_ref", "[Perm16][042]") { + REQUIRE(Perm16::one().left_weak_leq_ref(Perm16::one())); + REQUIRE(Perm16::one().left_weak_leq_ref(PPa)); + REQUIRE(Perm16::one().left_weak_leq_ref(PPb)); + REQUIRE(PPa.left_weak_leq_ref(PPa)); + REQUIRE(PPb.left_weak_leq_ref(PPb)); } -BOOST_FIXTURE_TEST_CASE(Perm16_left_weak_leq, Fix) { +TEST_CASE_METHOD(Perm16Fixture, "Perm16::left_weak_leq", "[Perm16][043]") { for (auto u : PlistSmall) { for (auto v : PlistSmall) { - BOOST_TEST(u.left_weak_leq(v) == u.left_weak_leq_ref(v)); - BOOST_TEST(u.left_weak_leq_length(v) == u.left_weak_leq_ref(v)); + REQUIRE(u.left_weak_leq(v) == u.left_weak_leq_ref(v)); + REQUIRE(u.left_weak_leq_length(v) == u.left_weak_leq_ref(v)); } } } - -BOOST_AUTO_TEST_SUITE_END() -//****************************************************************************// +} // namespace HPCombi diff --git a/tests/test_perm_all.cpp b/tests/test_perm_all.cpp index 2267761c..9895e201 100644 --- a/tests/test_perm_all.cpp +++ b/tests/test_perm_all.cpp @@ -13,44 +13,32 @@ /* http://www.gnu.org/licenses/ */ /******************************************************************************/ -#define BOOST_TEST_MODULE perm_generic - #include +#include +#include #include -#include -#include -#include - -//____________________________________________________________________________// - -template struct IsPermFunctions { - static bool is_perm(const VectType a) { return a.is_permutation(); }; - static bool is_perm2(const VectType a, size_t i) { - return a.is_permutation(i); - }; -}; - #include "perm16.hpp" #include "perm_generic.hpp" -//____________________________________________________________________________// +#include "test_main.hpp" +#include -template -struct Fixture : public IsPermFunctions { +namespace HPCombi { +namespace { - using VectType = typename _PermType::vect; - using PermType = _PermType; +template struct Fixture1 { - Fixture() + using VectType = typename Perm_::vect; + using PermType = Perm_; + + Fixture1() : zero({0}), V01({0, 1}), V10({1, 0}), V11({1, 1}), V1({}, 1), PPa({1, 2, 3, 4, 0, 5}), PPb({1, 2, 3, 6, 0, 5}), czero(zero), cV01(V01), RandPerm({3, 1, 0, 5, 10, 2, 6, 7, 4, 8, 9}), Plist({PPa, PPb, RandPerm}), - Vlist({zero, V01, V10, V11, V1, PPa, PPb, RandPerm}) { - BOOST_TEST_MESSAGE("setup fixture"); - } - ~Fixture() { BOOST_TEST_MESSAGE("teardown fixture"); } + Vlist({zero, V01, V10, V11, V1, PPa, PPb, RandPerm}) {} + ~Fixture1() {} VectType zero, V01, V10, V11, V1; PermType PPa, PPb; @@ -59,314 +47,351 @@ struct Fixture : public IsPermFunctions { const std::vector Plist; const std::vector Vlist; - static bool less(const VectType a, const VectType b) { return a < b; }; - static bool not_less(const VectType a, const VectType b) { - return not(a < b); - }; - // some tests assume that the size is at least 6 static_assert(VectType::Size() >= 6, "Minimum size for tests"); }; -//____________________________________________________________________________// - -typedef boost::mpl::list< - Fixture, Fixture>, - Fixture>, Fixture>, - Fixture>, Fixture>, - Fixture>> - Fixtures; +} // namespace -//____________________________________________________________________________// +// Better than std::tuple because we can see the actual types in the output +// with a macro but not with the tuple. +#define PermTypes \ + Perm16, PermGeneric<12>, PermGeneric<16>, PermGeneric<32>, \ + PermGeneric<42>, PermGeneric<49>, (PermGeneric<350, uint32_t>) -BOOST_AUTO_TEST_SUITE(VectType_test) -//____________________________________________________________________________// - -BOOST_FIXTURE_TEST_CASE_TEMPLATE(sizeof_test, F, Fixtures, F) { - BOOST_TEST(sizeof(F::zero) == F::VectType::Size() * sizeof(F::zero[0])); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "sizeof", "[PermAll][000]", PermTypes) { + REQUIRE(sizeof(Fixture1::zero) == + Fixture1::VectType::Size() * + sizeof(Fixture1::zero[0])); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(equal_test, F, Fixtures, F) { - BOOST_TEST(F::zero == F::zero); - BOOST_TEST(F::zero != F::V01); - for (unsigned i = 0; i < F::Plist.size(); i++) - for (unsigned j = 0; j < F::Plist.size(); j++) - if (i == j) - BOOST_TEST(F::Plist[i] == F::Plist[j]); - else - BOOST_TEST(F::Plist[i] != F::Plist[j]); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "operator==", "[PermAll][001]", PermTypes) { + REQUIRE(Fixture1::zero == Fixture1::zero); + REQUIRE(Fixture1::zero != Fixture1::V01); + for (unsigned i = 0; i < Fixture1::Plist.size(); i++) { + for (unsigned j = 0; j < Fixture1::Plist.size(); j++) { + if (i == j) { + REQUIRE(Fixture1::Plist[i] == + Fixture1::Plist[j]); + } else { + REQUIRE(Fixture1::Plist[i] != + Fixture1::Plist[j]); + } + } + } } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(operator_bracket_const_test, F, Fixtures, F) { - BOOST_TEST(F::czero[0] == 0u); - BOOST_TEST(F::czero[1] == 0u); - if (F::czero.Size() > 12) - BOOST_TEST(F::czero[12] == 0u); - if (F::czero.Size() > 15) - BOOST_TEST(F::czero[15] == 0u); - BOOST_TEST(F::cV01[0] == 0u); - BOOST_TEST(F::cV01[1] == 1u); - BOOST_TEST(F::cV01[2] == 0u); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "operator[] const", "[PermAll][002]", + PermTypes) { + REQUIRE(Fixture1::czero[0] == 0u); + REQUIRE(Fixture1::czero[1] == 0u); + if (Fixture1::czero.Size() > 12) { + REQUIRE(Fixture1::czero[12] == 0u); + } + if (Fixture1::czero.Size() > 15) { + REQUIRE(Fixture1::czero[15] == 0u); + } + REQUIRE(Fixture1::cV01[0] == 0u); + REQUIRE(Fixture1::cV01[1] == 1u); + REQUIRE(Fixture1::cV01[2] == 0u); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(operator_bracket_test, F, Fixtures, F) { - BOOST_TEST(F::zero[0] == 0u); - BOOST_TEST(F::zero[1] == 0u); - if (F::czero.Size() > 12) - BOOST_TEST(F::zero[12] == 0u); - if (F::czero.Size() > 15) - BOOST_TEST(F::zero[15] == 0u); - BOOST_TEST(F::V01[0] == 0u); - BOOST_TEST(F::V01[1] == 1u); - BOOST_TEST(F::V01[2] == 0u); - BOOST_TEST(F::PPa[4] == 0u); - BOOST_TEST(F::PPa[5] == 5u); - F::zero[0] = 3; - BOOST_TEST(F::zero[0] == 3u); - BOOST_TEST(F::zero[1] == 0u); - if (F::czero.Size() > 12) - BOOST_TEST(F::zero[12] == 0u); - if (F::czero.Size() > 15) - BOOST_TEST(F::zero[15] == 0u); - F::PPa[2] = 0; - BOOST_TEST(F::PPa[1] == 2u); - BOOST_TEST(F::PPa[2] == 0u); - BOOST_TEST(F::PPa[3] == 4u); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "operator[]", "[PermAll][003]", PermTypes) { + REQUIRE(Fixture1::zero[0] == 0u); + REQUIRE(Fixture1::zero[1] == 0u); + if (Fixture1::czero.Size() > 12) { + REQUIRE(Fixture1::zero[12] == 0u); + } + if (Fixture1::czero.Size() > 15) { + REQUIRE(Fixture1::zero[15] == 0u); + } + REQUIRE(Fixture1::V01[0] == 0u); + REQUIRE(Fixture1::V01[1] == 1u); + REQUIRE(Fixture1::V01[2] == 0u); + REQUIRE(Fixture1::PPa[4] == 0u); + REQUIRE(Fixture1::PPa[5] == 5u); + Fixture1::zero[0] = 3; + REQUIRE(Fixture1::zero[0] == 3u); + REQUIRE(Fixture1::zero[1] == 0u); + if (Fixture1::czero.Size() > 12) { + REQUIRE(Fixture1::zero[12] == 0u); + } + if (Fixture1::czero.Size() > 15) { + REQUIRE(Fixture1::zero[15] == 0u); + } + Fixture1::PPa[2] = 0; + REQUIRE(Fixture1::PPa[1] == 2u); + REQUIRE(Fixture1::PPa[2] == 0u); + REQUIRE(Fixture1::PPa[3] == 4u); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(operator_less_test, F, Fixtures, F) { - for (unsigned i = 0; i < F::Plist.size(); i++) - for (unsigned j = 0; j < F::Plist.size(); j++) - if (i < j) - BOOST_CHECK_PREDICATE(F::less, (F::Plist[i])(F::Plist[j])); - else - BOOST_CHECK_PREDICATE(F::not_less, (F::Plist[i])(F::Plist[j])); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "operator<", "[AllPerm][004]", PermTypes) { + for (unsigned i = 0; i < Fixture1::Plist.size(); i++) { + for (unsigned j = 0; j < Fixture1::Plist.size(); j++) { + if (i < j) { + REQUIRE(Fixture1::Plist[i] < + Fixture1::Plist[j]); + } else { + REQUIRE(!(Fixture1::Plist[i] < + Fixture1::Plist[j])); + } + } + } } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(operator_less_partial_test, F, Fixtures, F) { - for (auto p : F::Plist) - for (unsigned k = 0; k < F::PermType::size(); k++) - BOOST_TEST(p.less_partial(p, k) == 0); - for (auto p : F::Plist) - for (auto q : F::Plist) - BOOST_TEST(p.less_partial(q, 0) == 0); - - BOOST_TEST(F::zero.less_partial(F::V01, 1) == 0); - BOOST_TEST(F::V01.less_partial(F::zero, 1) == 0); - BOOST_TEST(F::zero.less_partial(F::V01, 2) < 0); - BOOST_TEST(F::V01.less_partial(F::zero, 2) > 0); - - BOOST_TEST(F::zero.less_partial(F::V10, 1) < 0); - BOOST_TEST(F::zero.less_partial(F::V10, 2) < 0); - BOOST_TEST(F::V10.less_partial(F::zero, 1) > 0); - BOOST_TEST(F::V10.less_partial(F::zero, 2) > 0); - - BOOST_TEST(F::PPa.less_partial(F::PPb, 1) == 0); - BOOST_TEST(F::PPa.less_partial(F::PPb, 2) == 0); - BOOST_TEST(F::PPa.less_partial(F::PPb, 3) == 0); - BOOST_TEST(F::PPa.less_partial(F::PPb, 4) < 0); - BOOST_TEST(F::PPa.less_partial(F::PPb, 5) < 0); - BOOST_TEST(F::PPb.less_partial(F::PPa, 4) > 0); - BOOST_TEST(F::PPb.less_partial(F::PPa, 5) > 0); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "less_partial", "[AllPerm][005]", + PermTypes) { + for (auto p : Fixture1::Plist) { + for (unsigned k = 0; k < Fixture1::PermType::size(); k++) { + REQUIRE(p.less_partial(p, k) == 0); + } + } + for (auto p : Fixture1::Plist) { + for (auto q : Fixture1::Plist) { + REQUIRE(p.less_partial(q, 0) == 0); + } + } + + REQUIRE(Fixture1::zero.less_partial(Fixture1::V01, 1) == + 0); + REQUIRE(Fixture1::V01.less_partial(Fixture1::zero, 1) == + 0); + REQUIRE(Fixture1::zero.less_partial(Fixture1::V01, 2) < + 0); + REQUIRE(Fixture1::V01.less_partial(Fixture1::zero, 2) > + 0); + + REQUIRE(Fixture1::zero.less_partial(Fixture1::V10, 1) < + 0); + REQUIRE(Fixture1::zero.less_partial(Fixture1::V10, 2) < + 0); + REQUIRE(Fixture1::V10.less_partial(Fixture1::zero, 1) > + 0); + REQUIRE(Fixture1::V10.less_partial(Fixture1::zero, 2) > + 0); + + REQUIRE(Fixture1::PPa.less_partial(Fixture1::PPb, 1) == + 0); + REQUIRE(Fixture1::PPa.less_partial(Fixture1::PPb, 2) == + 0); + REQUIRE(Fixture1::PPa.less_partial(Fixture1::PPb, 3) == + 0); + REQUIRE(Fixture1::PPa.less_partial(Fixture1::PPb, 4) < + 0); + REQUIRE(Fixture1::PPa.less_partial(Fixture1::PPb, 5) < + 0); + REQUIRE(Fixture1::PPb.less_partial(Fixture1::PPa, 4) > + 0); + REQUIRE(Fixture1::PPb.less_partial(Fixture1::PPa, 5) > + 0); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(first_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.first_zero() == 0u); - BOOST_TEST(F::V01.first_zero() == 0u); - BOOST_TEST(F::PPa.first_zero() == 4u); - BOOST_TEST(F::V10.first_zero() == 1u); - BOOST_TEST(F::V1.first_zero() == F::VectType::Size()); - BOOST_TEST(F::V10.first_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.first_zero(5) == 4u); - BOOST_TEST(F::PPa.first_zero(3) == F::VectType::Size()); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "first_zero", "[AllPerm][006]", PermTypes) { + REQUIRE(Fixture1::zero.first_zero() == 0u); + REQUIRE(Fixture1::V01.first_zero() == 0u); + REQUIRE(Fixture1::PPa.first_zero() == 4u); + REQUIRE(Fixture1::V10.first_zero() == 1u); + REQUIRE(Fixture1::V1.first_zero() == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::V10.first_zero(1) == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::PPa.first_zero(5) == 4u); + REQUIRE(Fixture1::PPa.first_zero(3) == + Fixture1::VectType::Size()); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(last_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.last_zero() == F::VectType::Size() - 1); - BOOST_TEST(F::V01.last_zero() == F::VectType::Size() - 1); - BOOST_TEST(F::PPa.last_zero() == 4u); - BOOST_TEST(F::V1.last_zero() == F::VectType::Size()); - BOOST_TEST(F::V01.last_zero(1) == 0u); - BOOST_TEST(F::V10.last_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.last_zero(5) == 4u); - BOOST_TEST(F::PPa.last_zero(3) == F::VectType::Size()); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "last_zero", "[AllPerm][007]", PermTypes) { + REQUIRE(Fixture1::zero.last_zero() == + Fixture1::VectType::Size() - 1); + REQUIRE(Fixture1::V01.last_zero() == + Fixture1::VectType::Size() - 1); + REQUIRE(Fixture1::PPa.last_zero() == 4u); + REQUIRE(Fixture1::V1.last_zero() == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::V01.last_zero(1) == 0u); + REQUIRE(Fixture1::V10.last_zero(1) == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::PPa.last_zero(5) == 4u); + REQUIRE(Fixture1::PPa.last_zero(3) == + Fixture1::VectType::Size()); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(first_non_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.first_non_zero() == F::VectType::Size()); - BOOST_TEST(F::V01.first_non_zero() == 1u); - BOOST_TEST(F::PPa.first_non_zero() == 0u); - BOOST_TEST(F::V01.first_non_zero() == 1u); - BOOST_TEST(F::V01.first_non_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.first_non_zero(5) == 0u); - BOOST_TEST(F::PPa.first_non_zero(3) == 0u); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "first_non_zero", "[AllPerm][008]", + PermTypes) { + REQUIRE(Fixture1::zero.first_non_zero() == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::V01.first_non_zero() == 1u); + REQUIRE(Fixture1::PPa.first_non_zero() == 0u); + REQUIRE(Fixture1::V01.first_non_zero() == 1u); + REQUIRE(Fixture1::V01.first_non_zero(1) == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::PPa.first_non_zero(5) == 0u); + REQUIRE(Fixture1::PPa.first_non_zero(3) == 0u); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(last_non_zero_test, F, Fixtures, F) { - BOOST_TEST(F::zero.last_non_zero() == F::VectType::Size()); - BOOST_TEST(F::V01.last_non_zero() == 1u); - BOOST_TEST(F::PPa.last_non_zero() == F::VectType::Size() - 1); - BOOST_TEST(F::V01.last_non_zero() == 1u); - BOOST_TEST(F::V01.last_non_zero(1) == F::VectType::Size()); - BOOST_TEST(F::PPa.last_non_zero(5) == 3u); - BOOST_TEST(F::PPa.last_non_zero(3) == 2u); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "last_non_zero", "[AllPerm][009]", + PermTypes) { + REQUIRE(Fixture1::zero.last_non_zero() == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::V01.last_non_zero() == 1u); + REQUIRE(Fixture1::PPa.last_non_zero() == + Fixture1::VectType::Size() - 1); + REQUIRE(Fixture1::V01.last_non_zero() == 1u); + REQUIRE(Fixture1::V01.last_non_zero(1) == + Fixture1::VectType::Size()); + REQUIRE(Fixture1::PPa.last_non_zero(5) == 3u); + REQUIRE(Fixture1::PPa.last_non_zero(3) == 2u); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(permuted_test, F, Fixtures, F) { - BOOST_TEST(F::zero.permuted(F::zero) == F::zero); - BOOST_TEST(F::V01.permuted(F::V01) == F::V01); - BOOST_TEST(F::V10.permuted(F::V10) == typename F::VectType({0, 1}, 1)); - BOOST_TEST(F::V10.permuted(F::V01) == typename F::VectType({1, 0}, 1)); - BOOST_TEST(F::V01.permuted(F::V10) == F::V10); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "permuted", "[AllPerm][010]", PermTypes) { + REQUIRE(Fixture1::zero.permuted(Fixture1::zero) == + Fixture1::zero); + REQUIRE(Fixture1::V01.permuted(Fixture1::V01) == + Fixture1::V01); + REQUIRE(Fixture1::V10.permuted(Fixture1::V10) == + typename Fixture1::VectType({0, 1}, 1)); + REQUIRE(Fixture1::V10.permuted(Fixture1::V01) == + typename Fixture1::VectType({1, 0}, 1)); + REQUIRE(Fixture1::V01.permuted(Fixture1::V10) == + Fixture1::V10); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(operator_insert_test, F, Fixtures, F) { +TEMPLATE_TEST_CASE_METHOD(Fixture1, "operator_insert", "[AllPerm][011]", + PermTypes) { std::ostringstream out, out2; - out << F::zero; + out << Fixture1::zero; out2 << "[ 0"; - for (size_t i = 1; i < F::VectType::Size(); i++) + for (size_t i = 1; i < Fixture1::VectType::Size(); i++) out2 << ", 0"; out2 << "]"; - BOOST_TEST(out.str() == out2.str()); + REQUIRE(out.str() == out2.str()); out.str(""); out2.str(""); - out << F::V01; + out << Fixture1::V01; out2 << "[ 0, 1"; - for (size_t i = 2; i < F::VectType::Size(); i++) + for (size_t i = 2; i < Fixture1::VectType::Size(); i++) out2 << ", 0"; out2 << "]"; - BOOST_TEST(out.str() == out2.str()); + REQUIRE(out.str() == out2.str()); out.str(""); out2.str(""); - out << F::PPa; + out << Fixture1::PPa; out2 << "[ 1, 2, 3, 4, 0"; - for (size_t i = 5; i < F::VectType::Size(); i++) + for (size_t i = 5; i < Fixture1::VectType::Size(); i++) out2 << "," << std::setw(2) << i; out2 << "]"; - BOOST_TEST(out.str() == out2.str()); + REQUIRE(out.str() == out2.str()); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(is_permutation_test, F, Fixtures, F) { - BOOST_CHECK_PREDICATE(boost::not1(F::is_perm), (F::zero)); - BOOST_CHECK_PREDICATE(F::is_perm, (F::PPa)); - BOOST_CHECK_PREDICATE(boost::not1(F::is_perm), (F::PPb)); - BOOST_CHECK_PREDICATE(F::is_perm, (F::RandPerm)); - BOOST_CHECK_PREDICATE( - boost::not1(F::is_perm), - (typename F::VectType({3, 1, 0, 9, 3, 10, 2, 11, 6, 7, 4, 8}))); - BOOST_CHECK_PREDICATE(F::is_perm2, (F::PPa)(16)); - BOOST_CHECK_PREDICATE(boost::not2(F::is_perm2), (F::RandPerm)(4)); - BOOST_CHECK_PREDICATE(F::is_perm2, (F::PPa)(5)); - BOOST_CHECK_PREDICATE(boost::not2(F::is_perm2), (F::PPa)(4)); +TEMPLATE_TEST_CASE_METHOD(Fixture1, "is_permutation", "[AllPerm][012]", + PermTypes) { + REQUIRE(!Fixture1::zero.is_permutation()); + REQUIRE(Fixture1::PPa.is_permutation()); + REQUIRE(!Fixture1::PPb.is_permutation()); + REQUIRE(Fixture1::RandPerm.is_permutation()); + REQUIRE(!typename Fixture1::VectType( + {3, 1, 0, 9, 3, 10, 2, 11, 6, 7, 4, 8}) + .is_permutation()); + REQUIRE(Fixture1::PPa.is_permutation(16)); + REQUIRE(!Fixture1::RandPerm.is_permutation(4)); + REQUIRE(Fixture1::PPa.is_permutation(5)); + REQUIRE(!Fixture1::PPa.is_permutation(4)); } -BOOST_AUTO_TEST_SUITE_END() - -//____________________________________________________________________________// -//____________________________________________________________________________// - -template struct PermFixture : public IsPermFunctions<_Perm> { - using PermType = _Perm; - PermFixture() +template struct Fixture2 { + using PermType = Perm_; + Fixture2() : id(PermType::one()), RandPerm({3, 1, 0, 5, 10, 2, 11, 6, 7, 4, 8, 9}), Plist({id, RandPerm}) { for (uint64_t i = 0; i < std::min(PermType::size(), 30) - 1; - i++) + i++) { Plist.push_back(PermType::elementary_transposition(i)); + } for (uint64_t i = std::max(30, PermType::size() - 20); - i < PermType::size() - 1; i++) + i < PermType::size() - 1; i++) { Plist.push_back(PermType::elementary_transposition(i)); - for (uint64_t i = 0; i < 10; i++) + } + for (uint64_t i = 0; i < 10; i++) { Plist.push_back(PermType::random()); - BOOST_TEST_MESSAGE("setup fixture"); + } } - ~PermFixture() { BOOST_TEST_MESSAGE("teardown fixture"); } + ~Fixture2() = default; PermType id, s1, s2, s3; const PermType RandPerm; std::vector Plist; }; -//____________________________________________________________________________// - -typedef boost::mpl::list, - PermFixture>, - PermFixture>, - PermFixture>, - PermFixture>, - PermFixture>, - PermFixture>> - PermFixtures; - -//____________________________________________________________________________// - -BOOST_AUTO_TEST_SUITE(PermType_test) -//____________________________________________________________________________// - -BOOST_FIXTURE_TEST_CASE_TEMPLATE(constructor_is_permutation_test, F, - PermFixtures, F) { - for (auto x : F::Plist) - BOOST_CHECK_PREDICATE(F::is_perm, (x)); - - // Default constructor doesn't initialize - // BOOST_CHECK_PREDICATE(F::is_perm, (typename F::PermType())); - BOOST_CHECK_PREDICATE(F::is_perm, (typename F::PermType({}))); - BOOST_CHECK_PREDICATE(F::is_perm, (typename F::PermType({1, 0}))); - BOOST_CHECK_PREDICATE(F::is_perm, (typename F::PermType({1, 2, 0}))); - BOOST_CHECK_PREDICATE(boost::not1(F::is_perm), - (typename F::PermType({1, 2}))); +TEMPLATE_TEST_CASE_METHOD(Fixture2, + "is_permutation for freshly constructed perms", + "[AllPerm][013]", PermTypes) { + using Perm = typename Fixture2::PermType; + for (auto x : Fixture2::Plist) { + REQUIRE(Perm(x).is_permutation()); + } + REQUIRE(Perm({}).is_permutation()); + REQUIRE(Perm({1, 0}).is_permutation()); + REQUIRE(Perm({1, 2, 0}).is_permutation()); + REQUIRE(!Perm({1, 2}).is_permutation()); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(std_hash_test, F, PermFixtures, F) { - for (auto x : F::Plist) - BOOST_TEST(std::hash()(x) != 0); +TEMPLATE_TEST_CASE_METHOD(Fixture2, "std::hash", "[AllPerm][014]", PermTypes) { + for (auto x : Fixture2::Plist) { + REQUIRE(std::hash::PermType>()(x) != 0); + } } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(mult_coxeter_test, F, PermFixtures, F) { - for (uint64_t i = 0; i < F::PermType::Size() - 1; i++) { - auto si = F::PermType::elementary_transposition(i); - BOOST_TEST(si != F::id); - BOOST_TEST(si * si == F::id); - if (i + 1 < F::PermType::Size() - 1) { - auto si1 = F::PermType::elementary_transposition(i + 1); - BOOST_TEST(si * si1 * si == si1 * si * si1); +TEMPLATE_TEST_CASE_METHOD(Fixture2, "mult_coxeter", "[AllPerm][015]", + PermTypes) { + const size_t n = TestType::Size() - 1; + + for (uint64_t i = 0; i < n; i++) { + auto si = TestType::elementary_transposition(i); + REQUIRE(si != Fixture2::id); + REQUIRE(si * si == Fixture2::id); + if (i + 1 < n) { + auto si1 = TestType::elementary_transposition(i + 1); + REQUIRE(si * si1 * si == si1 * si * si1); } - for (uint64_t j = i + 2; j < F::PermType::Size() - 1; j++) { - auto sj = F::PermType::elementary_transposition(j); - BOOST_TEST(sj * si == si * sj); + for (uint64_t j = i + 2; j < n; j++) { + auto sj = TestType::elementary_transposition(j); + REQUIRE(sj * si == si * sj); } } } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(mult_test, F, PermFixtures, F) { - for (auto x : F::Plist) { - BOOST_TEST(F::id * x == x); - BOOST_TEST(x * F::id == x); +TEMPLATE_TEST_CASE_METHOD(Fixture2, "mult", "[AllPerm][016]", PermTypes) { + for (auto x : Fixture2::Plist) { + REQUIRE(Fixture2::id * x == x); + REQUIRE(x * Fixture2::id == x); + } + REQUIRE(Fixture2::RandPerm * Fixture2::RandPerm == + TestType({5, 1, 3, 2, 8, 0, 9, 11, 6, 10, 7, 4})); + + for (auto x : Fixture2::Plist) { + for (auto y : Fixture2::Plist) { + for (auto z : Fixture2::Plist) { + REQUIRE((x * y) * z == x * (y * z)); + } + } } - BOOST_TEST(F::RandPerm * F::RandPerm == - typename F::PermType({5, 1, 3, 2, 8, 0, 9, 11, 6, 10, 7, 4})); - - for (auto x : F::Plist) - for (auto y : F::Plist) - for (auto z : F::Plist) - BOOST_TEST((x * y) * z == x * (y * z)); } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(inverse_test, F, PermFixtures, F) { - for (auto x : F::Plist) { - BOOST_TEST(x.inverse() * x == F::id); - BOOST_TEST(x * x.inverse() == F::id); - BOOST_TEST(x.inverse().inverse() == x); +TEMPLATE_TEST_CASE_METHOD(Fixture2, "inverse", "[AllPerm][017]", PermTypes) { + for (auto x : Fixture2::Plist) { + REQUIRE(x.inverse() * x == Fixture2::id); + REQUIRE(x * x.inverse() == Fixture2::id); + REQUIRE(x.inverse().inverse() == x); } } -BOOST_FIXTURE_TEST_CASE_TEMPLATE(random_test, F, PermFixtures, F) { +TEMPLATE_TEST_CASE_METHOD(Fixture2, "random", "[AllPerm][018]", PermTypes) { for (int i = 0; i < 100; i++) { - BOOST_CHECK_PREDICATE(F::is_perm, (F::PermType::random())); + REQUIRE(Fixture2::PermType::random().is_permutation()); } } -BOOST_AUTO_TEST_SUITE_END() +} // namespace HPCombi