1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-24 01:54:22 +00:00

improve enum_from_string, static_assert and doc

This commit is contained in:
terik23 2019-03-31 20:05:20 +05:00
parent 935f80ee49
commit 100ca7ba8c
2 changed files with 46 additions and 14 deletions

View file

@ -34,7 +34,7 @@ enum Directions { Up = 85, Down = -42, Right = 119, Left = -119 };
enum number : int { one = 10, two = 20, three = 30 };
TEST_CASE("magic_enum::enum_to_string(value)") {
TEST_CASE("magic_enum::enum_to_string(enum)") {
Color cr = Color::RED;
Color cm[3] = {Color::RED, Color::GREEN, Color::BLUE};
REQUIRE(magic_enum::enum_to_string(cr).value() == "RED");
@ -62,7 +62,7 @@ TEST_CASE("magic_enum::enum_to_string(value)") {
REQUIRE(!magic_enum::enum_to_string(static_cast<number>(MAGIC_ENUM_MAX_SEARCH_DEPTH)).has_value());
}
TEST_CASE("magic_enum::enum_to_string<value>()") {
TEST_CASE("magic_enum::enum_to_string<enum>()") {
constexpr Color cr = Color::RED;
constexpr Color cm[3] = {Color::RED, Color::GREEN, Color::BLUE};
REQUIRE(magic_enum::enum_to_string<cr>().value() == "RED");