Skip to content

Commit

Permalink
Fix for_each_n test for GCC7
Browse files Browse the repository at this point in the history
  • Loading branch information
alugowski committed Nov 14, 2023
1 parent 97043cd commit 41e5eae
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions tests/poolstl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 41e5eae

Please sign in to comment.