Add enchantum as an enum reflection backend (#441)

---------

Co-authored-by: Dr. Patrick Urbanke <patrick@getml.com>
This commit is contained in:
ZXShady
2025-05-29 23:16:59 +02:00
committed by GitHub
co-authored by Dr. Patrick Urbanke
parent 3b6a3bb3c7
commit 750e67d630
36 changed files with 1959 additions and 441 deletions
+7 -2
View File
@@ -14,19 +14,24 @@ enum class LineColor : uint16_t { yellow = 200, purple = 300, orange = 400 };
// Define the range of the LineColor enum
template <>
struct rfl::config::enum_range<test_enum_range_min_max::LineColor> {
static constexpr int min = 200;
static constexpr int min = 190;
static constexpr int max = 400;
};
namespace test_enum_range_min_max {
TEST(generic, test_enum_range_min_max) {
static_assert(!rfl::internal::enums::range_defined<InnerColor>,
"Range should not be defined.");
static_assert(rfl::internal::enums::range_defined<LineColor>,
"Range should be defined.");
auto [inner_min, inner_max] = rfl::get_enum_range<InnerColor>();
EXPECT_EQ(inner_min, RFL_ENUM_RANGE_MIN);
EXPECT_EQ(inner_max, RFL_ENUM_RANGE_MAX);
auto [line_min, line_max] = rfl::get_enum_range<LineColor>();
EXPECT_EQ(line_min, 200);
EXPECT_EQ(line_min, 190);
EXPECT_EQ(line_max, 400);
}