mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-21 01:24:21 +00:00
remove enum_traits (#38)
This commit is contained in:
parent
11b9c109b3
commit
2b9f24fd2c
5 changed files with 203 additions and 183 deletions
|
|
@ -567,31 +567,12 @@ TEST_CASE("type_traits") {
|
|||
REQUIRE_FALSE(is_scoped_enum_v<number>);
|
||||
}
|
||||
|
||||
TEST_CASE("enum_traits") {
|
||||
REQUIRE(enum_traits<Color&>::type_name == "Color");
|
||||
REQUIRE(enum_traits<Numbers>::type_name == "Numbers");
|
||||
REQUIRE(enum_traits<Directions&>::type_name == "Directions");
|
||||
REQUIRE(enum_traits<number>::type_name == "number");
|
||||
|
||||
REQUIRE_FALSE(enum_traits<Color&>::is_unscoped);
|
||||
REQUIRE_FALSE(enum_traits<Numbers>::is_unscoped);
|
||||
REQUIRE(enum_traits<Directions&>::is_unscoped);
|
||||
REQUIRE(enum_traits<number>::is_unscoped);
|
||||
|
||||
REQUIRE(enum_traits<Color&>::is_scoped);
|
||||
REQUIRE(enum_traits<Numbers>::is_scoped);
|
||||
REQUIRE_FALSE(enum_traits<Directions&>::is_scoped);
|
||||
REQUIRE_FALSE(enum_traits<number>::is_scoped);
|
||||
|
||||
REQUIRE_FALSE(enum_traits<Color&>::is_dense);
|
||||
REQUIRE(enum_traits<Numbers>::is_dense);
|
||||
REQUIRE_FALSE(enum_traits<Directions&>::is_dense);
|
||||
REQUIRE_FALSE(enum_traits<number>::is_dense);
|
||||
|
||||
REQUIRE(enum_traits<Color&>::is_sparse);
|
||||
REQUIRE_FALSE(enum_traits<Numbers>::is_sparse);
|
||||
REQUIRE(enum_traits<Directions&>::is_sparse);
|
||||
REQUIRE(enum_traits<number>::is_sparse);
|
||||
TEST_CASE("enum_type_name") {
|
||||
REQUIRE(enum_type_name<Color&>() == "Color");
|
||||
REQUIRE(enum_type_name<Numbers>() == "Numbers");
|
||||
REQUIRE(enum_type_name<Directions&>() == "Directions");
|
||||
REQUIRE(enum_type_name<number>() == "number");
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1920
|
||||
|
|
@ -628,6 +609,11 @@ TEST_CASE("extrema") {
|
|||
NONE = std::numeric_limits<std::uint64_t>::max()
|
||||
};
|
||||
|
||||
REQUIRE(magic_enum::enum_name<BadColor>(BadColor::NONE).empty());
|
||||
REQUIRE_FALSE(magic_enum::enum_cast<BadColor>(std::numeric_limits<std::uint64_t>::max()).has_value());
|
||||
REQUIRE_FALSE(magic_enum::enum_contains<BadColor>(std::numeric_limits<std::uint64_t>::max()));
|
||||
REQUIRE_FALSE(magic_enum::enum_contains<BadColor>(BadColor::NONE));
|
||||
|
||||
SECTION("min") {
|
||||
REQUIRE(magic_enum::enum_range<BadColor>::min == MAGIC_ENUM_RANGE_MIN);
|
||||
REQUIRE(magic_enum::detail::reflected_min_v<BadColor> == 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue