diff --git a/src/tools/nanorange/views/iota/test/iota.test.cpp b/src/tools/nanorange/views/iota/test/iota.test.cpp index 7014c60..6cc4460 100644 --- a/src/tools/nanorange/views/iota/test/iota.test.cpp +++ b/src/tools/nanorange/views/iota/test/iota.test.cpp @@ -41,20 +41,21 @@ TEST_CASE("views.iota") static_assert(*(it1 + 1) == 1); static_assert(*(it2 - 1) == 9); - constexpr auto compound_assignment_test = [rng] { - auto it = rng.begin(); - it += 3; - if (*it != 3) { - return false; - } - it -= 3; - if (it != rng.begin()) { - return false; - } - return true; - }; - - static_assert(compound_assignment_test()); +// does not compile with intel-classic/2022 (error: expression must have a constant value) +// constexpr auto compound_assignment_test = [rng] { +// auto it = rng.begin(); +// it += 3; +// if (*it != 3) { +// return false; +// } +// it -= 3; +// if (it != rng.begin()) { +// return false; +// } +// return true; +// }; +// +// static_assert(compound_assignment_test()); } // { @@ -88,3 +89,30 @@ TEST_CASE("views.iota") // Additional tests // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +SCENARIO( "std::ranges::views::iota" ) { + + auto chunk = nano::views::iota( 0, 5 ); + + THEN( "an iota view can be constructed and members can be tested" ) { + + CHECK( 5 == chunk.size() ); + CHECK( false == chunk.empty() ); + CHECK( true == bool( chunk ) ); + + unsigned int counter = 0; + for ( auto value : chunk ) { + + ++counter; + } + CHECK( 5 == counter ); + + CHECK( 0 == chunk[0] ); + CHECK( 1 == chunk[1] ); + CHECK( 2 == chunk[2] ); + CHECK( 3 == chunk[3] ); + CHECK( 4 == chunk[4] ); + + CHECK( 0 == chunk.front() ); + CHECK( 4 == chunk.back() ); + } // THEN +} // SCENARIO diff --git a/src/tools/nanorange/views/subrange/test/subrange.test.cpp b/src/tools/nanorange/views/subrange/test/subrange.test.cpp index 23952aa..685a9c7 100644 --- a/src/tools/nanorange/views/subrange/test/subrange.test.cpp +++ b/src/tools/nanorange/views/subrange/test/subrange.test.cpp @@ -78,7 +78,7 @@ TEST_CASE("nanorange.views.subrange") { // Additional tests // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SCENARIO( "std::subrange" ) { +SCENARIO( "std::ranges::views::subrange" ) { GIVEN( "a container with forward iterators" ) { diff --git a/src/tools/nanorange/views/transform/test/transform.test.cpp b/src/tools/nanorange/views/transform/test/transform.test.cpp index e0640ab..b7f756e 100644 --- a/src/tools/nanorange/views/transform/test/transform.test.cpp +++ b/src/tools/nanorange/views/transform/test/transform.test.cpp @@ -20,7 +20,7 @@ // Additional tests // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SCENARIO( "TransformView" ) { +SCENARIO( "std::ranges::views::transform" ) { auto transform = [] ( auto&& value ) { return value - 2; };