diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/iterable_suite.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
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<std::array<int, 3>>); - using type_alias = nt::new_type<std::array<int, 3>, struct tag, deriving(nt::Iterable)>; + static_assert(nt::impl::has_member_begin_v<with_member>); + using type_alias = nt::new_type<with_member, struct tag, deriving(nt::Iterable)>; ASSERT(nt::impl::has_member_begin_v<type_alias>); } 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<std::array<int const, 3>>); - using type_alias = nt::new_type<std::array<int, 3>, struct tag, deriving(nt::Iterable)>; + static_assert(nt::impl::has_member_begin_v<with_member const>); + using type_alias = nt::new_type<with_member, struct tag, deriving(nt::Iterable)>; ASSERT(nt::impl::has_member_begin_v<type_alias const>); } + 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<with_member>); + using type_alias = nt::new_type<with_member, struct tag, deriving(nt::Iterable)>; + ASSERT(!nt::impl::has_free_begin_v<type_alias>); + } + + 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<with_member const>); + using type_alias = nt::new_type<with_member, struct tag, deriving(nt::Iterable)>; + ASSERT(!nt::impl::has_free_begin_v<type_alias const>); + } + } // namespace begin_tests auto iterable_suite() -> std::pair<cute::suite, std::string> @@ -56,6 +79,8 @@ auto iterable_suite() -> std::pair<cute::suite, std::string> 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 |
