Lines Matching refs:ftl
27 static_assert(ftl::enum_begin_v<E> == E::A);
28 static_assert(ftl::enum_last_v<E> == E::F);
29 static_assert(ftl::enum_size_v<E> == 6);
31 static_assert(ftl::enum_name<E::B>() == "B");
32 static_assert(ftl::enum_name<E::ftl_last>() == "F");
33 static_assert(ftl::enum_name(E::C).value_or("?") == "C");
34 static_assert(ftl::enum_name(E{3}).value_or("?") == "?");
36 static_assert(ftl::enum_name_full<E::B>() == "E::B");
37 static_assert(ftl::enum_name_full<E::ftl_last>() == "E::F");
38 static_assert(ftl::enum_name_full(E::C).value_or("?") == "E::C");
39 static_assert(ftl::enum_name_full(E{3}).value_or("?") == "?");
43 static_assert(ftl::enum_begin_v<F> == F{0});
44 static_assert(ftl::enum_last_v<F> == F{15});
45 static_assert(ftl::enum_size_v<F> == 16);
47 static_assert(ftl::flag_name(F::Z).value_or("?") == "Z");
48 static_assert(ftl::flag_name(F{0b111}).value_or("?") == "?");
60 static_assert(ftl::enum_begin_v<Flags> == Flags{0});
61 static_assert(ftl::enum_last_v<Flags> == Flags{7});
62 static_assert(ftl::enum_size_v<Flags> == 8);
64 static_assert(ftl::enum_name<Flags::kNone>() == "kNone");
65 static_assert(ftl::enum_name<Flags::kFlag4>() == "kFlag4");
66 static_assert(ftl::enum_name<Flags::kFlag7>() == "kFlag7");
68 static_assert(ftl::enum_name_full<Flags::kNone>() == "Flags::kNone");
69 static_assert(ftl::enum_name_full<Flags::kFlag4>() == "Flags::kFlag4");
70 static_assert(ftl::enum_name_full<Flags::kFlag7>() == "Flags::kFlag7");
84 constexpr Planet kPluto{ftl::to_underlying(Planet::kNeptune) + 1}; // Honorable mention.
86 static_assert(ftl::enum_begin_v<Planet> == Planet::kMercury);
87 static_assert(ftl::enum_last_v<Planet> == Planet::kNeptune);
88 static_assert(ftl::enum_size_v<Planet> == 8);
90 static_assert(ftl::enum_name<Planet::kMercury>() == "kMercury");
91 static_assert(ftl::enum_name<Planet::kSaturn>() == "kSaturn");
93 static_assert(ftl::enum_name_full<Planet::kMercury>() == "Planet::kMercury");
94 static_assert(ftl::enum_name_full<Planet::kSaturn>() == "Planet::kSaturn");
106 static_assert(ftl::enum_begin_v<Temperature> == kFreezer);
107 static_assert(ftl::enum_last_v<Temperature> == kRoom);
108 static_assert(ftl::enum_size_v<Temperature> == 39);
110 static_assert(ftl::enum_name<kFreezer>() == "kFreezer");
111 static_assert(ftl::enum_name<kFridge>() == "kFridge");
112 static_assert(ftl::enum_name<kRoom>() == "kRoom");
118 for (E v : ftl::enum_range<E>()) { in TEST()
119 string += ftl::enum_name(v).value_or("?"); in TEST()
126 EXPECT_EQ(ftl::flag_name(Flags::kFlag1), "kFlag1"); in TEST()
127 EXPECT_EQ(ftl::flag_name(Flags::kFlag7), "kFlag7"); in TEST()
129 EXPECT_EQ(ftl::flag_name(Flags::kNone), std::nullopt); in TEST()
130 EXPECT_EQ(ftl::flag_name(Flags::kMask), std::nullopt); in TEST()
131 EXPECT_EQ(ftl::flag_name(Flags::kAll), std::nullopt); in TEST()
134 EXPECT_EQ(ftl::enum_name(Planet::kEarth), "kEarth"); in TEST()
135 EXPECT_EQ(ftl::enum_name(Planet::kNeptune), "kNeptune"); in TEST()
137 EXPECT_EQ(ftl::enum_name_full(Planet::kEarth), "Planet::kEarth"); in TEST()
138 EXPECT_EQ(ftl::enum_name_full(Planet::kNeptune), "Planet::kNeptune"); in TEST()
140 EXPECT_EQ(ftl::enum_name(kPluto), std::nullopt); in TEST()
141 EXPECT_EQ(ftl::enum_name_full(kPluto), std::nullopt); in TEST()
144 EXPECT_EQ(ftl::enum_name(kRoom), "kRoom"); in TEST()
145 EXPECT_EQ(ftl::enum_name(kFridge), "kFridge"); in TEST()
146 EXPECT_EQ(ftl::enum_name(kFreezer), "kFreezer"); in TEST()
148 EXPECT_EQ(ftl::enum_name(kRoom), "kRoom"); in TEST()
149 EXPECT_EQ(ftl::enum_name(kFridge), "kFridge"); in TEST()
150 EXPECT_EQ(ftl::enum_name(kFreezer), "kFreezer"); in TEST()
152 EXPECT_EQ(ftl::enum_name(static_cast<Temperature>(-30)), std::nullopt); in TEST()
153 EXPECT_EQ(ftl::enum_name(static_cast<Temperature>(0)), std::nullopt); in TEST()
154 EXPECT_EQ(ftl::enum_name(static_cast<Temperature>(100)), std::nullopt); in TEST()
156 EXPECT_EQ(ftl::enum_name_full(static_cast<Temperature>(-30)), std::nullopt); in TEST()
157 EXPECT_EQ(ftl::enum_name_full(static_cast<Temperature>(0)), std::nullopt); in TEST()
158 EXPECT_EQ(ftl::enum_name_full(static_cast<Temperature>(100)), std::nullopt); in TEST()
164 EXPECT_EQ(ftl::flag_string(Flags::kFlag1), "kFlag1"); in TEST()
165 EXPECT_EQ(ftl::flag_string(Flags::kFlag7), "kFlag7"); in TEST()
167 EXPECT_EQ(ftl::flag_string(Flags::kNone), "0b0"); in TEST()
168 EXPECT_EQ(ftl::flag_string(Flags::kMask), "0b10010010"); in TEST()
169 EXPECT_EQ(ftl::flag_string(Flags::kAll), "0b11111111"); in TEST()
177 EXPECT_EQ(ftl::flag_string(Flags64::kFlag0), "kFlag0"); in TEST()
178 EXPECT_EQ(ftl::flag_string(Flags64::kFlag63), "kFlag63"); in TEST()
179 EXPECT_EQ(ftl::flag_string(Flags64::kMask), "0x8000000000000001"); in TEST()
182 EXPECT_EQ(ftl::enum_string(Planet::kEarth), "kEarth"); in TEST()
183 EXPECT_EQ(ftl::enum_string(Planet::kNeptune), "kNeptune"); in TEST()
185 EXPECT_EQ(ftl::enum_string_full(Planet::kEarth), "Planet::kEarth"); in TEST()
186 EXPECT_EQ(ftl::enum_string_full(Planet::kNeptune), "Planet::kNeptune"); in TEST()
188 EXPECT_EQ(ftl::enum_string(kPluto), "8"); in TEST()
190 EXPECT_EQ(ftl::enum_string_full(kPluto), "8"); in TEST()
194 EXPECT_EQ(ftl::enum_string(kRoom), "kRoom"); in TEST()
195 EXPECT_EQ(ftl::enum_string(kFridge), "kFridge"); in TEST()
196 EXPECT_EQ(ftl::enum_string(kFreezer), "kFreezer"); in TEST()
198 EXPECT_EQ(ftl::enum_string_full(kRoom), "20"); in TEST()
199 EXPECT_EQ(ftl::enum_string_full(kFridge), "4"); in TEST()
200 EXPECT_EQ(ftl::enum_string_full(kFreezer), "-18"); in TEST()
202 EXPECT_EQ(ftl::enum_string(static_cast<Temperature>(-30)), "-30"); in TEST()
203 EXPECT_EQ(ftl::enum_string(static_cast<Temperature>(0)), "0"); in TEST()
204 EXPECT_EQ(ftl::enum_string(static_cast<Temperature>(100)), "100"); in TEST()
206 EXPECT_EQ(ftl::enum_string_full(static_cast<Temperature>(-30)), "-30"); in TEST()
207 EXPECT_EQ(ftl::enum_string_full(static_cast<Temperature>(0)), "0"); in TEST()
208 EXPECT_EQ(ftl::enum_string_full(static_cast<Temperature>(100)), "100"); in TEST()