From 943033bc921bb328bbc354f15627dbf4bd6ab1e4 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 22 Feb 2020 18:29:07 +0100 Subject: new_type: fix enablement of begin --- test/src/iterable_suite.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/src/iterable_suite.cpp b/test/src/iterable_suite.cpp index 2470571..bf478e1 100644 --- a/test/src/iterable_suite.cpp +++ b/test/src/iterable_suite.cpp @@ -14,7 +14,16 @@ namespace { -} + struct with_member + { + using iterator = void *; + using const_iterator = void const *; + + auto begin() -> iterator; + auto begin() const -> const_iterator; + }; + +} // namespace inline namespace begin_tests { @@ -34,18 +43,32 @@ inline namespace begin_tests auto a_new__type_based_on_an_iterable_type_with_member_begin_deriving_iterable_has_member_begin() -> void { - static_assert(nt::impl::has_member_begin_v>); - using type_alias = nt::new_type, struct tag, deriving(nt::Iterable)>; + static_assert(nt::impl::has_member_begin_v); + using type_alias = nt::new_type; ASSERT(nt::impl::has_member_begin_v); } auto a_new__type_based_on_an_iterable_type_with_constant_member_begin_deriving_iterable_has_constant_member_begin() -> void { - static_assert(nt::impl::has_member_begin_v>); - using type_alias = nt::new_type, struct tag, deriving(nt::Iterable)>; + static_assert(nt::impl::has_member_begin_v); + using type_alias = nt::new_type; ASSERT(nt::impl::has_member_begin_v); } + auto a_new__type_based_on_an_iterable_type_without_free_begin_deriving_iterable_has_no_free_begin() -> void + { + static_assert(!nt::impl::has_free_begin_v); + using type_alias = nt::new_type; + ASSERT(!nt::impl::has_free_begin_v); + } + + auto a_new__type_based_on_an_iterable_type_without_constant_free_begin_deriving_iterable_has_no_constant_free_begin() -> void + { + static_assert(!nt::impl::has_free_begin_v); + using type_alias = nt::new_type; + ASSERT(!nt::impl::has_free_begin_v); + } + } // namespace begin_tests auto iterable_suite() -> std::pair @@ -56,6 +79,8 @@ auto iterable_suite() -> std::pair KAWAII(a_new__type_based_on_a_non_iterable_type_deriving_iterable_has_no_begin), KAWAII(a_new__type_based_on_an_iterable_type_with_member_begin_deriving_iterable_has_member_begin), KAWAII(a_new__type_based_on_an_iterable_type_with_constant_member_begin_deriving_iterable_has_constant_member_begin), + KAWAII(a_new__type_based_on_an_iterable_type_without_free_begin_deriving_iterable_has_no_free_begin), + KAWAII(a_new__type_based_on_an_iterable_type_without_constant_free_begin_deriving_iterable_has_no_constant_free_begin), }, "Iterable Tests"}; } \ No newline at end of file -- cgit v1.2.3