#include #include TEST_CASE("TypeVal", "[obfs::Sequence]") { using val = obfs::TypeVal; static_assert(std::is_same_v); static_assert(val::value == 10); } TEST_CASE("Sequence", "[obfs::Sequence]") { using seq = obfs::Sequence; static_assert(std::is_same_v); static_assert(seq::size == 10); static_assert(seq::index<0>::value == 0); static_assert(seq::index<5>::value == 5); static_assert(seq::index<9>::value == 9); static_assert(std::is_same_v, obfs::Nothing>); } TEST_CASE("TypeSeq", "[obfs::Sequence]") { using namespace obfs; using seq = TypeSeq, TypeVal, TypeVal, TypeVal>; static_assert(seq::size == 4); static_assert(seq::index<0>::value == 0); static_assert(seq::index<2>::value == 2); static_assert(seq::index<3>::value == 3); static_assert(std::is_same_v, Nothing>); } TEST_CASE("MinVal", "[obfs::Sequence]") { using min = obfs::MinVal<1, 3, 2, 4, 9, 5, 6, 0, 7, 8>; static_assert(min::value == 0); } TEST_CASE("SeqPack", "[obfs::Sequence]") { using pack = obfs::SeqPack< obfs::Sequence, obfs::Sequence, obfs::Sequence >; static_assert(pack::size == 4); using item = pack::index<2>; static_assert(item::size == 3); static_assert(item::index<0>::value == 2); static_assert(item::index<1>::value == 3); static_assert(item::index<2>::value == 4); } template using condition = std::conditional_t<(Val::value > 3), Val, obfs::Pass>; template using first = typename obfs::First...>::type; TEST_CASE("First", "[obfs::Sequence]") { using result = first< obfs::TypeVal, obfs::TypeVal, obfs::TypeVal, obfs::TypeVal, obfs::TypeVal, obfs::TypeVal>; static_assert(result::value == 5); }