1
1
#include < stdx/type_traits.hpp>
2
2
3
+ #include < catch2/catch_template_test_macros.hpp>
3
4
#include < catch2/catch_test_macros.hpp>
4
5
5
6
#include < type_traits>
@@ -25,8 +26,18 @@ TEST_CASE("to_underlying values", "[type_traits]") {
25
26
CHECK (stdx::to_underlying (ScopedEnum::Value5) == 5 );
26
27
}
27
28
28
- TEST_CASE (" to_underlying works on integral types" , " [type_traits]" ) {
29
- constexpr int x = 0 ;
30
- CHECK (std::is_same_v<decltype (stdx::to_underlying (x)), int >);
31
- CHECK (stdx::to_underlying (x) == 0 );
29
+ TEMPLATE_TEST_CASE (" to_underlying works on integral types" , " [type_traits]" ,
30
+ bool , char , signed char , unsigned char , short int ,
31
+ unsigned short int , int , unsigned int , long int ,
32
+ unsigned long int ) {
33
+ constexpr TestType x{};
34
+ CHECK (std::is_same_v<decltype (stdx::to_underlying (x)), TestType>);
35
+ CHECK (stdx::to_underlying (x) == TestType{});
36
+ }
37
+
38
+ TEMPLATE_TEST_CASE (" to_underlying works on floating point types" ,
39
+ " [type_traits]" , float , double ) {
40
+ constexpr TestType x{};
41
+ CHECK (std::is_same_v<decltype (stdx::to_underlying (x)), TestType>);
42
+ CHECK (stdx::to_underlying (x) == TestType{});
32
43
}
0 commit comments