|
6 | 6 | #include <catch2/catch_template_test_macros.hpp>
|
7 | 7 | #include <catch2/catch_test_macros.hpp>
|
8 | 8 |
|
| 9 | +#include <array> |
| 10 | + |
9 | 11 | using pseudo_pext_direct = lookup::pseudo_pext_lookup<>;
|
10 | 12 | using pseudo_pext_indirect_1 = lookup::pseudo_pext_lookup<true, 1>;
|
11 | 13 | 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]",
|
98 | 100 | CHECK(lookup[some_key_t::KAPPA] == 87);
|
99 | 101 | CHECK(lookup[some_key_t::GAMMA] == 4);
|
100 | 102 | }
|
| 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