mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-03 08:46:19 +08:00
rfl::UnderlyingEnums (#186)
* First part * Plural * Update rfl.hpp * Documentation * Update rfl.hpp * Update processors.md * underlying_enums test * Update Parser_default.hpp * Fix typo in test
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <rfl.hpp>
|
||||
#include <rfl/json.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "write_and_read.hpp"
|
||||
|
||||
namespace test_underlying_enums {
|
||||
|
||||
enum class Color { red, green, blue, yellow };
|
||||
|
||||
struct Circle {
|
||||
float radius;
|
||||
Color color;
|
||||
};
|
||||
|
||||
TEST(json, test_underlying_enums) {
|
||||
const auto circle = Circle{.radius = 2.0, .color = Color::green};
|
||||
|
||||
write_and_read<rfl::UnderlyingEnums>(circle, R"({"radius":2.0,"color":1})");
|
||||
}
|
||||
|
||||
} // namespace test_enum1
|
||||
Reference in New Issue
Block a user