From ea7281aa5076c13f29cc76a565d95b2a339379d0 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sun, 29 Dec 2019 00:39:18 +0100 Subject: new_type: rework special member function bases --- test/src/new_type_constructor_suite.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/src/new_type_constructor_suite.cpp b/test/src/new_type_constructor_suite.cpp index fa4c0b7..27b7452 100644 --- a/test/src/new_type_constructor_suite.cpp +++ b/test/src/new_type_constructor_suite.cpp @@ -38,6 +38,27 @@ inline namespace constructor_tests ASSERT((std::is_constructible_v)); } + auto a_new__type_instance_can_be_copy_constructed_if_the_base_type_can_be_copy_constructed() -> void + { + using type_alias = nt::new_type; + ASSERT((std::is_copy_constructible_v)); + } + + auto a_new__type_instance_can_not_be_copy_constructed_if_the_base_type_can_not_be_copy_constructed() -> void + { + struct not_copy_constructible + { + not_copy_constructible() = default; + not_copy_constructible(not_copy_constructible const &) = delete; + not_copy_constructible(not_copy_constructible &&) = default; + auto operator=(not_copy_constructible const &) -> not_copy_constructible & = default; + auto operator=(not_copy_constructible &&) -> not_copy_constructible & = default; + }; + + using type_alias = nt::new_type; + ASSERT(!(std::is_copy_constructible_v)); + } + } // namespace constructor_tests auto new_type_constructor_suite() -> std::pair @@ -63,6 +84,8 @@ auto new_type_constructor_suite() -> std::pair KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type), KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type), KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type), + KAWAII(a_new__type_instance_can_be_copy_constructed_if_the_base_type_can_be_copy_constructed), + KAWAII(a_new__type_instance_can_not_be_copy_constructed_if_the_base_type_can_not_be_copy_constructed), }, "new_type Constructor Tests"}; } \ No newline at end of file -- cgit v1.2.3