@@ -256,44 +256,53 @@ TEST_CASE("template bit_mask (single bit)", "[bit]") {
256256TEST_CASE (" template bit_mask (array type whole range)" , " [bit]" ) {
257257 using A = std::array<std::uint8_t , 3 >;
258258 constexpr auto m = stdx::bit_mask<A>();
259- CHECK (m == A{0xff , 0xff , 0xff });
259+ STATIC_REQUIRE (m == A{0xff , 0xff , 0xff });
260260}
261261
262262TEST_CASE (" template bit_mask (array type low bits)" , " [bit]" ) {
263263 using A = std::array<std::uint8_t , 3 >;
264264 constexpr auto m = stdx::bit_mask<A, 1 , 0 >();
265- CHECK (m == A{0b0000'0011 , 0 , 0 });
265+ STATIC_REQUIRE (m == A{0b0000'0011 , 0 , 0 });
266266}
267267
268268TEST_CASE (" template bit_mask (array type mid bits)" , " [bit]" ) {
269269 using A = std::array<std::uint8_t , 3 >;
270270 constexpr auto m = stdx::bit_mask<A, 19 , 4 >();
271- CHECK (m == A{0b1111'0000 , 0xff , 0b0000'1111 });
271+ STATIC_REQUIRE (m == A{0b1111'0000 , 0xff , 0b0000'1111 });
272272}
273273
274274TEST_CASE (" template bit_mask (array type high bits)" , " [bit]" ) {
275275 using A = std::array<std::uint8_t , 3 >;
276276 constexpr auto m = stdx::bit_mask<A, 23 , 20 >();
277- CHECK (m == A{0 , 0 , 0b1111'0000 });
277+ STATIC_REQUIRE (m == A{0 , 0 , 0b1111'0000 });
278278}
279279
280280TEST_CASE (" template bit_mask (array type single bit)" , " [bit]" ) {
281281 using A = std::array<std::uint8_t , 3 >;
282282 constexpr auto m = stdx::bit_mask<A, 5 , 5 >();
283- CHECK (m == A{0b0010'0000 , 0 , 0 });
283+ STATIC_REQUIRE (m == A{0b0010'0000 , 0 , 0 });
284284}
285285
286286TEST_CASE (" template bit_mask (array of array type)" , " [bit]" ) {
287287 using A = std::array<std::uint8_t , 1 >;
288288 using B = std::array<A, 3 >;
289289 constexpr auto m = stdx::bit_mask<B, 19 , 4 >();
290- CHECK (m == B{A{0b1111'0000 }, A{0xff }, A{0b0000'1111 }});
290+ STATIC_REQUIRE (m == B{A{0b1111'0000 }, A{0xff }, A{0b0000'1111 }});
291291}
292292
293293TEST_CASE (" template bit_mask (large array type)" , " [bit]" ) {
294294 using A = std::array<std::uint64_t , 4 >;
295295 constexpr auto m = stdx::bit_mask<A, 192 , 192 >();
296- CHECK (m == A{0 , 0 , 0 , 1 });
296+ STATIC_REQUIRE (m == A{0 , 0 , 0 , 1 });
297+ }
298+
299+ namespace {
300+ enum struct scoped_enum : std::uint8_t { A, B, C };
301+ } // namespace
302+
303+ TEST_CASE (" template bit_mask (enum type)" , " [bit]" ) {
304+ constexpr auto m = stdx::bit_mask<scoped_enum>();
305+ STATIC_REQUIRE (m == scoped_enum{0xffu });
297306}
298307
299308TEST_CASE (" arg bit_mask (whole range)" , " [bit]" ) {
@@ -326,6 +335,11 @@ TEST_CASE("arg bit_mask (single bit)", "[bit]") {
326335 STATIC_REQUIRE (std::is_same_v<decltype (m), std::uint8_t const >);
327336}
328337
338+ TEST_CASE (" arg bit_mask (enum type)" , " [bit]" ) {
339+ constexpr auto m = stdx::bit_mask<scoped_enum>(1 );
340+ STATIC_REQUIRE (m == scoped_enum{0b11u });
341+ }
342+
329343TEMPLATE_TEST_CASE (" bit_size" , " [bit]" , std::uint8_t , std::uint16_t ,
330344 std::uint32_t , std::uint64_t , std::int8_t , std::int16_t ,
331345 std::int32_t , std::int64_t ) {
0 commit comments