diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-05-08 00:15:26 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-05-08 00:15:26 +0200 |
commit | e1ba7dd7a976b2ce076b9361f761dd51cdf4b4ec (patch) | |
tree | 80c76c46ee2678aa39280220d1d6f82bed98ef1c /asl/base/utility_tests.cpp | |
parent | 837f696971677b4ed2263e744a9ce6d6d3865b11 (diff) |
Add enum underlying utilities
Diffstat (limited to 'asl/base/utility_tests.cpp')
-rw-r--r-- | asl/base/utility_tests.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/asl/base/utility_tests.cpp b/asl/base/utility_tests.cpp index 7e54bb2..ea3e7c6 100644 --- a/asl/base/utility_tests.cpp +++ b/asl/base/utility_tests.cpp @@ -81,3 +81,20 @@ ASL_TEST(forward_like) ASL_TEST_EXPECT(test_fwd_like<int&&>(9) == 4); } +enum class Enum : int // NOLINT +{ + kOne = 1, + kTwo = 2, +}; + +enum Enum2 : int // NOLINT +{ + kOne = 1, + kTwo = 2, +}; + +static_assert(asl::to_underlying(Enum::kOne) == 1); +static_assert(asl::to_underlying(Enum::kTwo) == 2); +static_assert(asl::to_underlying(kOne) == 1); +static_assert(asl::to_underlying(kTwo) == 2); + |