Skip to content

Commit 44b34d9

Browse files
committed
add std::array values to pseudo_pext unit test
1 parent 4bc0f7c commit 44b34d9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/lookup/pseudo_pext_lookup.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <catch2/catch_template_test_macros.hpp>
77
#include <catch2/catch_test_macros.hpp>
88

9+
#include <array>
10+
911
using pseudo_pext_direct = lookup::pseudo_pext_lookup<>;
1012
using pseudo_pext_indirect_1 = lookup::pseudo_pext_lookup<true, 1>;
1113
using pseudo_pext_indirect_2 = lookup::pseudo_pext_lookup<true, 2>;
@@ -98,3 +100,30 @@ TEMPLATE_TEST_CASE("lookup with scoped enum entries", "[pseudo pext lookup]",
98100
CHECK(lookup[some_key_t::KAPPA] == 87);
99101
CHECK(lookup[some_key_t::GAMMA] == 4);
100102
}
103+
104+
105+
106+
using val_t = std::array<std::uint32_t, 4>;
107+
constexpr static auto a = val_t{0, 1, 2, 3};
108+
constexpr static auto b = val_t{4, 5, 6, 7};
109+
constexpr static auto c = val_t{8, 9, 10, 11};
110+
constexpr static auto d = val_t{12, 13, 14, 15};
111+
112+
TEMPLATE_TEST_CASE("lookup with std::array values", "[pseudo pext lookup]",
113+
pseudo_pext_direct, pseudo_pext_indirect_1,
114+
pseudo_pext_indirect_2, pseudo_pext_indirect_3,
115+
pseudo_pext_indirect_4
116+
) {
117+
118+
constexpr auto lookup =
119+
TestType::make(CX_VALUE(lookup::input<std::uint32_t, val_t, 3>{
120+
a, std::array{lookup::entry{54u, b}, lookup::entry{324u, c},
121+
lookup::entry{64u, d}}}));
122+
123+
124+
125+
CHECK(lookup[0] == a);
126+
CHECK(lookup[54] == b);
127+
CHECK(lookup[324] == c);
128+
CHECK(lookup[64] == d);
129+
}

0 commit comments

Comments
 (0)