diff options
author | Håvard Pettersen <havardpe@yahooinc.com> | 2022-09-21 09:43:28 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@yahooinc.com> | 2022-09-21 11:47:13 +0000 |
commit | 95e8f34f7ee1e7df1db7ef52a189245289d51598 (patch) | |
tree | 20297f587675316621a4dd943f75923ad85de6cd /vespalib/src/tests/traits | |
parent | 04b195343586990e6a612d33e98c7fa8603ee0f4 (diff) |
use more concepts
Diffstat (limited to 'vespalib/src/tests/traits')
-rw-r--r-- | vespalib/src/tests/traits/traits_test.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/vespalib/src/tests/traits/traits_test.cpp b/vespalib/src/tests/traits/traits_test.cpp index c898f3b1892..896cec59666 100644 --- a/vespalib/src/tests/traits/traits_test.cpp +++ b/vespalib/src/tests/traits/traits_test.cpp @@ -2,6 +2,7 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/util/traits.h> #include <vespa/vespalib/util/arrayqueue.hpp> +#include <concepts> using namespace vespalib; @@ -27,19 +28,19 @@ struct Child2 : Base { VESPA_CAN_SKIP_DESTRUCTION(Child2); -TEST("require that is_copyable works") { - EXPECT_EQUAL(is_copyable<Simple>::value, true); - EXPECT_EQUAL(is_copyable<Hard>::value, false); - EXPECT_EQUAL(is_copyable<ArrayQueue<Simple> >::value, true); - EXPECT_EQUAL(is_copyable<ArrayQueue<Hard> >::value, false); - EXPECT_EQUAL(is_copyable<std::unique_ptr<Hard> >::value, false); +TEST("require that copy ctor detection works") { + EXPECT_EQUAL(std::copy_constructible<Simple>, true); + EXPECT_EQUAL(std::copy_constructible<Hard>, false); + EXPECT_EQUAL(std::copy_constructible<ArrayQueue<Simple> >, true); + EXPECT_EQUAL(std::copy_constructible<ArrayQueue<Hard> >, false); + EXPECT_EQUAL(std::copy_constructible<std::unique_ptr<Hard> >, false); } TEST("require that can_skip_destruction works") { - EXPECT_EQUAL(can_skip_destruction<Simple>::value, true); - EXPECT_EQUAL(can_skip_destruction<Hard>::value, false); - EXPECT_EQUAL(can_skip_destruction<Child1>::value, false); - EXPECT_EQUAL(can_skip_destruction<Child2>::value, true); + EXPECT_EQUAL(can_skip_destruction<Simple>, true); + EXPECT_EQUAL(can_skip_destruction<Hard>, false); + EXPECT_EQUAL(can_skip_destruction<Child1>, false); + EXPECT_EQUAL(can_skip_destruction<Child2>, true); } struct NoType {}; @@ -47,9 +48,9 @@ struct TypeType { using type = NoType; }; struct NoTypeType { static constexpr int type = 3; }; TEST("require that type type member can be detected") { - EXPECT_FALSE(has_type_type_v<NoType>); - EXPECT_TRUE(has_type_type_v<TypeType>); - EXPECT_FALSE(has_type_type_v<NoTypeType>); + EXPECT_FALSE(has_type_type<NoType>); + EXPECT_TRUE(has_type_type<TypeType>); + EXPECT_FALSE(has_type_type<NoTypeType>); } TEST_MAIN() { TEST_RUN_ALL(); } |