-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenum.test.cpp
40 lines (29 loc) · 926 Bytes
/
enum.test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <boost/ut.hpp>
#include <rebind/enum.hpp>
using namespace boost::ut;
enum class some_enum
{
a,
b,
c,
};
// NOLINTNEXTLINE
suite<"enum"> enum_test = []()
{
expect(rebind::type_name<some_enum> == "some_enum");
expect(rebind::nttp_name<some_enum::a> == "some_enum::a");
expect(rebind::enum_name<some_enum::a> == "a");
expect(rebind::enum_name<some_enum::b> == "b");
constexpr auto values = rebind::enum_values<some_enum>;
expect(values.size() == 3);
expect(values.at(0).name == "a");
expect(values.at(0).value == some_enum::a);
expect(values.at(1).name == "b");
expect(values.at(1).value == some_enum::b);
expect(values.at(2).name == "c");
expect(values.at(2).value == some_enum::c);
const auto value = rebind::enum_value(some_enum::c);
expect(value.has_value());
expect(value->name == "c");
expect(value->value == some_enum::c);
};