mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
Put get to magic_enum::containers namespace (#316)
This commit is contained in:
parent
016883d29a
commit
56dcb011c2
5 changed files with 24 additions and 28 deletions
|
|
@ -88,13 +88,13 @@ TEST_CASE("containers_array") {
|
|||
|
||||
constexpr auto colors = magic_enum::enum_values<Color>();
|
||||
|
||||
std::ignore = std::get<0>(compare_before);
|
||||
std::ignore = std::get<1>(compare_before);
|
||||
std::ignore = std::get<2>(compare_before);
|
||||
std::ignore = magic_enum::containers::get<0>(compare_before);
|
||||
std::ignore = magic_enum::containers::get<1>(compare_before);
|
||||
std::ignore = magic_enum::containers::get<2>(compare_before);
|
||||
|
||||
std::ignore = std::get<Color::RED>(compare_before);
|
||||
std::ignore = std::get<Color::GREEN>(compare_before);
|
||||
std::ignore = std::get<Color::BLUE>(compare_before);
|
||||
std::ignore = magic_enum::containers::get<Color::RED>(compare_before);
|
||||
std::ignore = magic_enum::containers::get<Color::GREEN>(compare_before);
|
||||
std::ignore = magic_enum::containers::get<Color::BLUE>(compare_before);
|
||||
|
||||
REQUIRE(std::make_pair(colors[0], color_rgb_container_int[colors[0]]) == std::make_pair<Color, std::uint8_t>(Color::RED, 1U));
|
||||
REQUIRE(std::make_pair(colors[1], color_rgb_container_int[colors[1]]) == std::make_pair<Color, std::uint8_t>(Color::GREEN, 4U));
|
||||
|
|
@ -107,13 +107,13 @@ TEST_CASE("containers_array") {
|
|||
constexpr magic_enum::containers::array<Color, std::uint8_t> compare_after{{1U, 2U, 4U}};
|
||||
REQUIRE(color_rgb_container_int == compare_after);
|
||||
|
||||
std::ignore = std::get<0>(compare_after);
|
||||
std::ignore = std::get<1>(compare_after);
|
||||
std::ignore = std::get<2>(compare_after);
|
||||
std::ignore = magic_enum::containers::get<0>(compare_after);
|
||||
std::ignore = magic_enum::containers::get<1>(compare_after);
|
||||
std::ignore = magic_enum::containers::get<2>(compare_after);
|
||||
|
||||
std::ignore = std::get<Color::RED>(compare_after);
|
||||
std::ignore = std::get<Color::GREEN>(compare_after);
|
||||
std::ignore = std::get<Color::BLUE>(compare_after);
|
||||
std::ignore = magic_enum::containers::get<Color::RED>(compare_after);
|
||||
std::ignore = magic_enum::containers::get<Color::GREEN>(compare_after);
|
||||
std::ignore = magic_enum::containers::get<Color::BLUE>(compare_after);
|
||||
|
||||
REQUIRE(std::make_pair(colors[0], color_rgb_container_int[colors[0]]) == std::make_pair<Color, std::uint8_t>(Color::RED, 1U));
|
||||
REQUIRE(std::make_pair(colors[1], color_rgb_container_int[colors[1]]) == std::make_pair<Color, std::uint8_t>(Color::GREEN, 2U));
|
||||
|
|
@ -145,9 +145,9 @@ TEST_CASE("containers_array") {
|
|||
REQUIRE(color_rgb_container.front() == RGB{color_max, 0, 0});
|
||||
REQUIRE(color_rgb_container.back() == RGB{0, 0, color_max});
|
||||
|
||||
REQUIRE(std::get<Color::RED>(color_rgb_container) == RGB{color_max, 0, 0});
|
||||
REQUIRE(std::get<Color::GREEN>(color_rgb_container) == RGB{0, color_max, 0});
|
||||
REQUIRE(std::get<Color::BLUE>(color_rgb_container) == RGB{0, 0, color_max});
|
||||
REQUIRE(magic_enum::containers::get<Color::RED>(color_rgb_container) == RGB{color_max, 0, 0});
|
||||
REQUIRE(magic_enum::containers::get<Color::GREEN>(color_rgb_container) == RGB{0, color_max, 0});
|
||||
REQUIRE(magic_enum::containers::get<Color::BLUE>(color_rgb_container) == RGB{0, 0, color_max});
|
||||
|
||||
auto iterator = color_rgb_container.begin();
|
||||
REQUIRE_FALSE(check_const(iterator));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue