|
| 1 | +#include <zeus/concepts.hpp> |
| 2 | + |
| 3 | +#include <catch2/catch_test_macros.hpp> |
| 4 | + |
| 5 | +TEST_CASE("[concepts] - Enum", "[zeus]") |
| 6 | +{ |
| 7 | + enum Foo |
| 8 | + { |
| 9 | + a = 0 |
| 10 | + }; |
| 11 | + |
| 12 | + enum class Bar |
| 13 | + { |
| 14 | + b = 0 |
| 15 | + }; |
| 16 | + |
| 17 | + STATIC_REQUIRE(zeus::Enum<Foo>); |
| 18 | + STATIC_REQUIRE(zeus::Enum<Bar>); |
| 19 | + STATIC_REQUIRE_FALSE(zeus::Enum<int>); |
| 20 | +} |
| 21 | + |
| 22 | +TEST_CASE("[concepts] - ScopedEnum", "[zeus]") |
| 23 | +{ |
| 24 | + enum Foo |
| 25 | + { |
| 26 | + a = 0 |
| 27 | + }; |
| 28 | + |
| 29 | + enum class Bar |
| 30 | + { |
| 31 | + b = 0 |
| 32 | + }; |
| 33 | + |
| 34 | + STATIC_REQUIRE(zeus::ScopedEnum<Bar>); |
| 35 | + STATIC_REQUIRE_FALSE(zeus::ScopedEnum<Foo>); |
| 36 | + STATIC_REQUIRE_FALSE(zeus::ScopedEnum<int>); |
| 37 | +} |
| 38 | + |
| 39 | +TEST_CASE("[concepts] - UnsignedEnum", "[zeus]") |
| 40 | +{ |
| 41 | + enum Foo : int |
| 42 | + { |
| 43 | + a |
| 44 | + }; |
| 45 | + |
| 46 | + enum Bar : unsigned char |
| 47 | + { |
| 48 | + b |
| 49 | + }; |
| 50 | + |
| 51 | + enum class Baz : int |
| 52 | + { |
| 53 | + c |
| 54 | + }; |
| 55 | + |
| 56 | + enum class Bumble : unsigned int |
| 57 | + { |
| 58 | + d |
| 59 | + }; |
| 60 | + |
| 61 | + STATIC_REQUIRE(zeus::UnsignedEnum<Bar>); |
| 62 | + STATIC_REQUIRE_FALSE(zeus::UnsignedEnum<Foo>); |
| 63 | + |
| 64 | + STATIC_REQUIRE(zeus::UnsignedEnum<Bumble>); |
| 65 | + STATIC_REQUIRE_FALSE(zeus::UnsignedEnum<Baz>); |
| 66 | +} |
| 67 | + |
| 68 | +TEST_CASE("[concepts] - UnsignedScopedEnum", "[zeus]") |
| 69 | +{ |
| 70 | + enum Foo : int |
| 71 | + { |
| 72 | + a |
| 73 | + }; |
| 74 | + |
| 75 | + enum Bar : unsigned char |
| 76 | + { |
| 77 | + b |
| 78 | + }; |
| 79 | + |
| 80 | + enum class Baz : int |
| 81 | + { |
| 82 | + c |
| 83 | + }; |
| 84 | + |
| 85 | + enum class Bumble : unsigned int |
| 86 | + { |
| 87 | + d |
| 88 | + }; |
| 89 | + |
| 90 | + STATIC_REQUIRE(zeus::UnsignedScopedEnum<Bumble>); |
| 91 | + STATIC_REQUIRE_FALSE(zeus::UnsignedScopedEnum<Baz>); |
| 92 | + STATIC_REQUIRE_FALSE(zeus::UnsignedScopedEnum<Bar>); |
| 93 | + STATIC_REQUIRE_FALSE(zeus::UnsignedScopedEnum<Foo>); |
| 94 | +} |
| 95 | + |
| 96 | +TEST_CASE("[concepts] - IntegralType", "[zeus]") |
| 97 | +{ |
| 98 | + STATIC_REQUIRE(zeus::IntegralType<char>); |
| 99 | + STATIC_REQUIRE(zeus::IntegralType<char8_t>); |
| 100 | + STATIC_REQUIRE(zeus::IntegralType<char16_t>); |
| 101 | + STATIC_REQUIRE(zeus::IntegralType<char32_t>); |
| 102 | + STATIC_REQUIRE(zeus::IntegralType<wchar_t>); |
| 103 | + STATIC_REQUIRE(zeus::IntegralType<short>); |
| 104 | + STATIC_REQUIRE(zeus::IntegralType<int>); |
| 105 | + STATIC_REQUIRE(zeus::IntegralType<long>); |
| 106 | + STATIC_REQUIRE(zeus::IntegralType<long long>); |
| 107 | + |
| 108 | + STATIC_REQUIRE_FALSE(zeus::IntegralType<float>); |
| 109 | + STATIC_REQUIRE_FALSE(zeus::IntegralType<double>); |
| 110 | + STATIC_REQUIRE_FALSE(zeus::IntegralType<long double>); |
| 111 | + STATIC_REQUIRE_FALSE(zeus::IntegralType<bool>); |
| 112 | +} |
| 113 | + |
| 114 | +TEST_CASE("[concepts] - ArithmeticType", "[zeus]") |
| 115 | +{ |
| 116 | + STATIC_REQUIRE(zeus::ArithmeticType<char>); |
| 117 | + STATIC_REQUIRE(zeus::ArithmeticType<char8_t>); |
| 118 | + STATIC_REQUIRE(zeus::ArithmeticType<char16_t>); |
| 119 | + STATIC_REQUIRE(zeus::ArithmeticType<char32_t>); |
| 120 | + STATIC_REQUIRE(zeus::ArithmeticType<wchar_t>); |
| 121 | + STATIC_REQUIRE(zeus::ArithmeticType<short>); |
| 122 | + STATIC_REQUIRE(zeus::ArithmeticType<int>); |
| 123 | + STATIC_REQUIRE(zeus::ArithmeticType<long>); |
| 124 | + STATIC_REQUIRE(zeus::ArithmeticType<long long>); |
| 125 | + STATIC_REQUIRE(zeus::ArithmeticType<float>); |
| 126 | + STATIC_REQUIRE(zeus::ArithmeticType<double>); |
| 127 | + STATIC_REQUIRE(zeus::ArithmeticType<long double>); |
| 128 | + |
| 129 | + STATIC_REQUIRE_FALSE(zeus::ArithmeticType<bool>); |
| 130 | +} |
0 commit comments