From 41e5eae30b7b8f907a94db04148b9c2fe266baf2 Mon Sep 17 00:00:00 2001 From: Adam Lugowski Date: Mon, 13 Nov 2023 21:45:07 -0800 Subject: [PATCH] Fix for_each_n test for GCC7 --- tests/poolstl_test.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/poolstl_test.cpp b/tests/poolstl_test.cpp index 05df600..3066685 100644 --- a/tests/poolstl_test.cpp +++ b/tests/poolstl_test.cpp @@ -50,20 +50,11 @@ TEST_CASE("for_each_n", "[alg]") { auto v = iota_vector(*std::max_element(test_arr_sizes.cbegin(), test_arr_sizes.cend())); for (auto num_iters : test_arr_sizes) { - for (auto is_sequential : {true, false}) { - sum = 0; - auto f = [&](auto) { ++sum; }; - if (is_sequential) { -#if HAVE_CXX17 - std::for_each_n(v.cbegin(), num_iters, f); -#endif - } else { - std::for_each_n(poolstl::par_pool(pool), v.cbegin(), num_iters, f); - } -#if HAVE_CXX17 - REQUIRE(sum == num_iters); -#endif - } + sum = 0; + auto f = [&](auto) { ++sum; }; + // sequential for_each_n has incomplete GCC7 support + std::for_each_n(poolstl::par_pool(pool), v.cbegin(), num_iters, f); + REQUIRE(sum == num_iters); } } }