aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2020-02-22 18:29:07 +0100
committerFelix Morgner <felix.morgner@gmail.com>2020-02-22 18:29:07 +0100
commit943033bc921bb328bbc354f15627dbf4bd6ab1e4 (patch)
treeb0ccb557b745fa778ef876d72647cc1c9de86e5e /test
parent89a9db0dfee60421a5d1a6093af0e554c6cf6be6 (diff)
downloadnewtype-943033bc921bb328bbc354f15627dbf4bd6ab1e4.tar.xz
newtype-943033bc921bb328bbc354f15627dbf4bd6ab1e4.zip
new_type: fix enablement of begin
Diffstat (limited to 'test')
-rw-r--r--test/src/iterable_suite.cpp35
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