based

Opinionated utility library
git clone git://git.dimitrijedobrota.com/based.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

is_base_of_test.cpp (628B)


0 #define CATCH_CONFIG_RUNTIME_STATIC_REQUIRE
2 #include <catch2/catch_test_macros.hpp>
4 #include "based/trait/is/base_of.hpp"
6 TEST_CASE("is_base_of", "[trait/is_base_of]")
7 {
8 // clang-format off
9 class a {};
10 class b : a {};
11 class c : b {};
12 class d {};
13 union e {};
14 using i = int;
16 STATIC_REQUIRE(based::is_base_of_v<a, a>);
17 STATIC_REQUIRE(based::is_base_of_v<a, b>);
18 STATIC_REQUIRE(based::is_base_of_v<a, c>);
19 STATIC_REQUIRE(!based::is_base_of_v<a, d>);
20 STATIC_REQUIRE(!based::is_base_of_v<b, a>);
21 STATIC_REQUIRE(!based::is_base_of_v<e, e>);
22 STATIC_REQUIRE(!based::is_base_of_v<i, i>);
23 // clang-format on
24 }