basedOpinionated utility library |
git clone git://git.dimitrijedobrota.com/based.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
is_const_test.cpp (1518B)
0 #define CATCH_CONFIG_RUNTIME_STATIC_REQUIRE
2 #include "based/concept/is_const.hpp"
4 #include <catch2/catch_test_macros.hpp>
6 TEST_CASE("IsConst", "[concept/IsConst]")
7 {
8 // clang-format off
9 struct Test {};
11 // NOLINTBEGIN(*array*)
12 STATIC_REQUIRE(based::trait::IsConst<const int>);
13 STATIC_REQUIRE(based::trait::IsConst<const int[2]>);
14 STATIC_REQUIRE(based::trait::IsConst<const volatile int>);
15 STATIC_REQUIRE(based::trait::IsConst<const volatile int[2]>);
16 STATIC_REQUIRE(not based::trait::IsConst<const int&>);
17 STATIC_REQUIRE(not based::trait::IsConst<const int(&)[2]>);
18 STATIC_REQUIRE(not based::trait::IsConst<const volatile int&>);
19 STATIC_REQUIRE(not based::trait::IsConst<const volatile int(&)[2]>);
20 STATIC_REQUIRE(not based::trait::IsConst<int&&>);
21 STATIC_REQUIRE(not based::trait::IsConst<int&>);
22 STATIC_REQUIRE(not based::trait::IsConst<int>);
23 STATIC_REQUIRE(not based::trait::IsConst<int(&&)[2]>);
24 STATIC_REQUIRE(not based::trait::IsConst<int(&)[2]>);
25 STATIC_REQUIRE(not based::trait::IsConst<int[2]>);
26 STATIC_REQUIRE(not based::trait::IsConst<int(int)>);
27 STATIC_REQUIRE(not based::trait::IsConst<volatile int&&>);
28 STATIC_REQUIRE(not based::trait::IsConst<volatile int&>);
29 STATIC_REQUIRE(not based::trait::IsConst<volatile int>);
30 STATIC_REQUIRE(not based::trait::IsConst<volatile int(&&)[2]>);
31 STATIC_REQUIRE(not based::trait::IsConst<volatile int(&)[2]>);
32 STATIC_REQUIRE(not based::trait::IsConst<volatile int[2]>);
33 // clang-format on
34 // NOLINTEND(*array*)
35 }