From b9271516773a08a3501b43f5a45466ccb0e7a2ab Mon Sep 17 00:00:00 2001 From: neargye Date: Thu, 24 Jun 2021 17:52:04 +0300 Subject: [PATCH] update tests --- test/test.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 34c11fa..74f38f0 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -54,8 +54,7 @@ enum number : unsigned long { #endif }; -enum class Binary : bool -{ +enum class Binary : bool { ONE, TWO }; @@ -339,6 +338,9 @@ TEST_CASE("enum_values") { constexpr auto& s4 = enum_values(); REQUIRE(s4 == std::array{{number::one, number::two, number::three}}); + + constexpr auto& s5 = enum_values(); + REQUIRE(s5 == std::array{{Binary::ONE, Binary::TWO}}); } TEST_CASE("enum_count") { @@ -353,6 +355,9 @@ TEST_CASE("enum_count") { constexpr auto s4 = enum_count(); REQUIRE(s4 == 3); + + constexpr auto s5 = enum_count(); + REQUIRE(s5 == 2); } TEST_CASE("enum_name") { @@ -420,6 +425,8 @@ TEST_CASE("enum_name") { REQUIRE(enum_name() == "two"); REQUIRE(nt_name == "three"); REQUIRE(enum_name() == "four"); + + REQUIRE(enum_name() == "ONE"); } } @@ -654,6 +661,9 @@ TEST_CASE("extrema") { REQUIRE(magic_enum::customize::enum_range::min == 100); REQUIRE(magic_enum::detail::reflected_min_v == 100); REQUIRE(magic_enum::detail::min_v == 100); + + REQUIRE(magic_enum::detail::reflected_min_v == 0); + REQUIRE(magic_enum::detail::min_v == false); } SECTION("max") { @@ -676,6 +686,9 @@ TEST_CASE("extrema") { REQUIRE(magic_enum::customize::enum_range::max == 300); REQUIRE(magic_enum::detail::reflected_max_v == 300); REQUIRE(magic_enum::detail::max_v == 300); + + REQUIRE(magic_enum::detail::reflected_max_v == 1); + REQUIRE(magic_enum::detail::max_v == true); } } @@ -743,9 +756,3 @@ TEST_CASE("cmp_less") { REQUIRE_FALSE(cmp_less(uint64_t_min, int32_t_min + offset_int64_t)); } } - -TEST_CASE("bool") { - REQUIRE(magic_enum::detail::reflected_min_v == 0); - REQUIRE(magic_enum::detail::reflected_max_v == 1); - REQUIRE(magic_enum::enum_values() == std::array{{Binary::ONE, Binary::TWO}}); -}