diff --git a/tests/unittests/std_interoperability.cpp b/tests/unittests/std_interoperability.cpp index 0e53685d7..9f65ddfb1 100644 --- a/tests/unittests/std_interoperability.cpp +++ b/tests/unittests/std_interoperability.cpp @@ -413,8 +413,8 @@ TEST_CASE("Collection AllocatorAwareContainer types", "[collection][container][t } // TODO add tests for AllocatorAwareContainer statements and expressions -TEST_CASE("Collection and iterator concepts", "[collection][container][iterator][std]") { #if (__cplusplus >= 202002L) +TEST_CASE("Collection and iterator concepts", "[collection][container][iterator][std]") { SECTION("input_or_output_iterator") { // weakly incrementable @@ -495,126 +495,33 @@ TEST_CASE("Collection and iterator concepts", "[collection][container][iterator] // const_iterator STATIC_REQUIRE(std::input_iterator); } +} - SECTION("output_iterator") { - // indirectly_writable - // iterator - DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); - // STATIC_REQUIRE(std::is_same_v, std::decay_t>); - // { - // auto coll = CollectionType{}; - // coll.create().cellID(42); - // auto e = iterator::value_type{13, 0, 0, 0, 0}; - // auto e_copy = e; - // auto o = coll.begin(); - // *o = e; - // REQUIRE(*o == e_copy); - // } - DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); - // STATIC_REQUIRE(std::is_same_v, std::decay_t>); - // { - // auto coll = CollectionType{}; - // coll.create().cellID(42); - // auto e = iterator::value_type::mutable_type{13, 0, 0, 0, 0}; - // auto e_copy =e; - // auto o = coll.begin(); - // *o = e; - // REQUIRE(*o == e_copy); - // } - // const_iterator - DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); - // STATIC_REQUIRE(std::is_same_v, std::decay_t>); - // { - // auto coll = CollectionType{}; - // coll.create().cellID(42); - // auto e = iterator::value_type{13, 0, 0, 0, 0}; - // auto e_copy = e; - // auto o = coll.cbegin(); - // *o = e; - // REQUIRE(*o == e_copy); - // } - DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); - // STATIC_REQUIRE(std::is_same_v, - // std::decay_t>); - // { - // auto coll = CollectionType{}; - // coll.create().cellID(42); - // auto e = iterator::value_type::mutable_type{13, 0, 0, 0, 0}; - // auto e_copy = e; - // auto o = coll.cbegin(); - // *o = e; - // REQUIRE(*o == e_copy); - // } - - // iterator - DOCUMENTED_STATIC_FAILURE(std::output_iterator); - DOCUMENTED_STATIC_FAILURE(std::output_iterator); - // const_iterator - DOCUMENTED_STATIC_FAILURE(std::output_iterator); - DOCUMENTED_STATIC_FAILURE(std::output_iterator); - } - - SECTION("forward_iterator") { - // iterator - DOCUMENTED_STATIC_FAILURE(std::forward_iterator); - // { - // REQUIRE(iterator{} == iterator{}); - // auto coll = CollectionType(); - // coll.create(); - // auto i = coll.begin(); - // auto j = coll.begin(); - // REQUIRE(i == j); - // REQUIRE(++i == ++j); - // i = coll.begin(); - // REQUIRE(((void)[](auto x) { ++x; }(i), *i) == *i); - // Pointers and references obtained from a forward iterator into a range remain valid while the range exists. - // Is this even unit-testable? - // } - // const_iterator - DOCUMENTED_STATIC_FAILURE(std::forward_iterator); - // { - // REQUIRE(const_iterator{} == const_iterator{}); - // auto coll = CollectionType(); - // coll.create(); - // auto i = coll.cbegin(); - // auto j = coll.cbegin(); - // REQUIRE(i == j); - // REQUIRE(++i == ++j); - // i = coll.cbegin(); - // REQUIRE(((void)[](auto x) { ++x; }(i), *i) == *i); - // Pointers and references obtained from a forward iterator into a range remain valid while the range exists. - // Is this even unit-testable? - // } - } - - SECTION("bidirectional_iterator") { - // iterator - DOCUMENTED_STATIC_FAILURE(std::bidirectional_iterator); - // TODO check semantic requirements - // const_iterator - DOCUMENTED_STATIC_FAILURE(std::bidirectional_iterator); - // TODO check semantic requirements - } - - SECTION("random_access_iterator") { - // iterator - DOCUMENTED_STATIC_FAILURE(std::random_access_iterator); - // TODO check semantic requirements - // const_iterator - DOCUMENTED_STATIC_FAILURE(std::random_access_iterator); - // TODO check semantic requirements - } - - SECTION("contiguous_iterator_iterator") { - // iterator - DOCUMENTED_STATIC_FAILURE(std::contiguous_iterator); - // TODO check semantic requirements - // const_iterator - DOCUMENTED_STATIC_FAILURE(std::contiguous_iterator); - // TODO check semantic requirements - } -#endif +TEST_CASE("Collection and unsupported iterator concepts", "[collection][container][iterator][std]") { + // std::indirectly_writable + DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); + DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); + DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); + DOCUMENTED_STATIC_FAILURE(std::indirectly_writable); + // std::output_iterator + DOCUMENTED_STATIC_FAILURE(std::output_iterator); + DOCUMENTED_STATIC_FAILURE(std::output_iterator); + DOCUMENTED_STATIC_FAILURE(std::output_iterator); + DOCUMENTED_STATIC_FAILURE(std::output_iterator); + // std::forward_iterator + DOCUMENTED_STATIC_FAILURE(std::forward_iterator); + DOCUMENTED_STATIC_FAILURE(std::forward_iterator); + // std::bidirectional_iterator + DOCUMENTED_STATIC_FAILURE(std::bidirectional_iterator); + DOCUMENTED_STATIC_FAILURE(std::bidirectional_iterator); + // std::random_access_iterator + DOCUMENTED_STATIC_FAILURE(std::random_access_iterator); + DOCUMENTED_STATIC_FAILURE(std::random_access_iterator); + // std::contiguous_iterator + DOCUMENTED_STATIC_FAILURE(std::contiguous_iterator); + DOCUMENTED_STATIC_FAILURE(std::contiguous_iterator); } +#endif // __cplusplus >= 202002L TEST_CASE("Collection iterators", "[collection][container][iterator][std]") { // the checks are duplicated for iterator and const_iterator as expectations on them are slightly different