42 lines
1.8 KiB
C++
42 lines
1.8 KiB
C++
#include <catch.hpp>
|
|
#include "../common.h"
|
|
|
|
#include <pfor/mp/tuple.h>
|
|
|
|
TEST_CASE("mp/tuple") {
|
|
using T0 = std::tuple<>;
|
|
using T1 = std::tuple<class A>;
|
|
using T2 = std::tuple<class A, class B>;
|
|
using T3 = std::tuple<class A, class B, class C>;
|
|
using T4 = std::tuple<class A, class B, class C, class D>;
|
|
using T5 = std::tuple<class A, class B, class C, class D, class E>;
|
|
using T6 = std::tuple<class A, class B, class C, class D, class E, class F>;
|
|
|
|
SECTION("SubTuple") {
|
|
SECTION("empty") {
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T0, UIntsToPack<>>, T0>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T1, UIntsToPack<>>, T0>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T2, UIntsToPack<>>, T0>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T3, UIntsToPack<>>, T0>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T4, UIntsToPack<>>, T0>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T5, UIntsToPack<>>, T0>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T6, UIntsToPack<>>, T0>);
|
|
}
|
|
|
|
SECTION("keep all") {
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T1, UIntsToPack<0>>, T1>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T2, UIntsToPack<0, 1>>, T2>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T3, UIntsToPack<0, 1, 2>>, T3>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T4, UIntsToPack<0, 1, 2, 3>>, T4>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T5, UIntsToPack<0, 1, 2, 3, 4>>, T5>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T6, UIntsToPack<0, 1, 2, 3, 4, 5>>, T6>);
|
|
}
|
|
|
|
SECTION("general") {
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T6, UIntsToPack<0, 0, 0>>, std::tuple<class A, class A, class A>>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T6, UIntsToPack<2, 1, 0>>, std::tuple<class C, class B, class A>>);
|
|
TEST(REQUIRE, is_same_v<pfor::SubTuple<T6, UIntsToPack<1, 3, 5>>, std::tuple<class B, class D, class F>>);
|
|
}
|
|
}
|
|
}
|