aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2019-12-29 00:39:18 +0100
committerFelix Morgner <felix.morgner@gmail.com>2019-12-29 00:39:18 +0100
commitea7281aa5076c13f29cc76a565d95b2a339379d0 (patch)
tree1bab86487bca2c108fc696770ae54d236631e19a /test
parentdfa16015a4fc5f2a97bc8a248637e2e90f90f513 (diff)
downloadnewtype-ea7281aa5076c13f29cc76a565d95b2a339379d0.tar.xz
newtype-ea7281aa5076c13f29cc76a565d95b2a339379d0.zip
new_type: rework special member function bases
Diffstat (limited to 'test')
-rw-r--r--test/src/new_type_constructor_suite.cpp23
1 files changed, 23 insertions, 0 deletions
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<nt_old, OldType>));
}
+ auto a_new__type_instance_can_be_copy_constructed_if_the_base_type_can_be_copy_constructed() -> void
+ {
+ using type_alias = nt::new_type<int, struct tag_type>;
+ ASSERT((std::is_copy_constructible_v<type_alias>));
+ }
+
+ 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<not_copy_constructible, struct tag_type>;
+ ASSERT(!(std::is_copy_constructible_v<type_alias>));
+ }
+
} // namespace constructor_tests
auto new_type_constructor_suite() -> std::pair<cute::suite, std::string>
@@ -63,6 +84,8 @@ auto new_type_constructor_suite() -> std::pair<cute::suite, std::string>
KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<float>),
KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<double>),
KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<long double>),
+ 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