diff --git a/libs/core/algorithms/tests/unit/algorithms/CMakeLists.txt b/libs/core/algorithms/tests/unit/algorithms/CMakeLists.txt index 5e82d391923..7d3a9204530 100644 --- a/libs/core/algorithms/tests/unit/algorithms/CMakeLists.txt +++ b/libs/core/algorithms/tests/unit/algorithms/CMakeLists.txt @@ -18,66 +18,44 @@ endforeach() # add tests set(tests adjacentdifference - adjacentdifference_sender adjacentfind adjacentfind_binary - adjacentfind_sender all_of - all_of_sender any_of - any_of_sender copy - copy_sender copyif_random copyif_forward copyif_exception copyif_bad_alloc copyn - copyn_sender count - count_sender countif - countif_sender destroy - destroy_sender destroyn - destroyn_sender distance ends_with - ends_with_sender equal equal_binary - equal_sender - equal_binary_sender exclusive_scan exclusive_scan2 exclusive_scan_exception exclusive_scan_bad_alloc exclusive_scan_validate fill - fill_sender filln - filln_sender find - find_sender findend - findend_sender findfirstof findfirstof_binary - findfirstof_sender findif - findif_sender findifnot - findifnot_sender foreach foreach_executors foreach_prefetching - foreach_sender foreach_scheduler foreachn foreachn_exception foreachn_bad_alloc - foreachn_sender for_loop for_loop_exception for_loop_induction @@ -88,78 +66,50 @@ set(tests for_loop_reduction_async for_loop_strided generate - generate_sender generaten - generaten_sender is_heap - is_heap_sender is_heap_until - is_heap_until_sender includes - includes_sender inclusive_scan inclusive_scan_exception inplace_merge is_partitioned - is_partitioned_sender is_sorted - is_sorted_sender is_sorted_until - is_sorted_until_sender lexicographical_compare - lexicographical_compare_sender make_heap max_element - max_element_sender merge min_element - min_element_sender minmax_element - minmax_element_sender mismatch mismatch_binary - mismatch_sender - mismatch_binary_sender move - move_sender nth_element none_of - none_of_sender parallel_sort partial_sort partial_sort_copy partition partition_copy reduce_ - reduce_sender reduce_by_key remove - remove_sender remove1 remove2 remove_if - remove_if_sender remove_if1 remove_copy remove_copy_if replace - replace_sender replace_if - replace_if_sender replace_copy - replace_copy_sender replace_copy_if - replace_copy_if_sender reverse reverse_copy - reverse_sender - reverse_copy_sender rotate rotate_copy - rotate_sender - rotate_copy_sender search - search_sender searchn set_difference set_intersection @@ -174,23 +124,16 @@ set(tests stable_sort stable_sort_exceptions starts_with - starts_with_sender swapranges - swapranges_sender transform - transform_sender transform_binary - transform_binary_sender transform_binary2 - transform_binary2_sender transform_exclusive_scan transform_inclusive_scan transform_reduce transform_reduce_binary transform_reduce_binary_exception transform_reduce_binary_bad_alloc - transform_reduce_sender - transform_reduce_binary_sender uninitialized_copy uninitialized_copyn uninitialized_default_construct @@ -205,7 +148,6 @@ set(tests uninitialized_value_construct uninitialized_value_constructn unique - unique_sender unique_copy ) @@ -213,6 +155,70 @@ if(HPX_WITH_CXX17_STD_EXECUTION_POLICES) set(tests ${tests} foreach_std_policies) endif() +if(HPX_WITH_STDEXEC) + set(tests + ${tests} + adjacentdifference_sender + adjacentfind_sender + all_of_sender + any_of_sender + copy_sender + copyn_sender + count_sender + countif_sender + destroy_sender + destroyn_sender + ends_with_sender + equal_sender + equal_binary_sender + fill_sender + filln_sender + find_sender + findend_sender + findfirstof_sender + findif_sender + findifnot_sender + foreach_sender + foreachn_sender + generate_sender + generaten_sender + is_heap_sender + is_heap_until_sender + includes_sender + is_partitioned_sender + is_sorted_sender + is_sorted_until_sender + lexicographical_compare_sender + max_element_sender + min_element_sender + minmax_element_sender + mismatch_sender + mismatch_binary_sender + move_sender + none_of_sender + reduce_sender + remove_sender + remove_if_sender + replace_sender + replace_if_sender + replace_copy_sender + replace_copy_if_sender + reverse_sender + reverse_copy_sender + rotate_sender + rotate_copy_sender + search_sender + starts_with_sender + swapranges_sender + transform_sender + transform_binary_sender + transform_binary2_sender + transform_reduce_sender + transform_reduce_binary_sender + unique_sender + ) +endif() + foreach(test ${tests}) set(sources ${test}.cpp) diff --git a/libs/core/algorithms/tests/unit/algorithms/adjacentdifference_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/adjacentdifference_tests.hpp index 9c1d304c765..c1d55b6a6a7 100644 --- a/libs/core/algorithms/tests/unit/algorithms/adjacentdifference_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/adjacentdifference_tests.hpp @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include #include @@ -68,6 +69,7 @@ void test_adjacent_difference_direct(Policy l, ExPolicy policy) HPX_TEST(std::end(d) == it); } +#if defined(HPX_HAVE_STDEXEC) template void test_adjacent_difference_sender(Policy l, ExPolicy&& policy) { @@ -117,6 +119,7 @@ void test_adjacent_difference_sender(Policy l, ExPolicy&& policy) [](auto lhs, auto rhs) { return lhs == rhs; })); HPX_TEST(++std::begin(d) == hpx::get<0>(*result)); } +#endif template void test_adjacent_difference_async(ExPolicy&& p) @@ -155,14 +158,10 @@ void test_adjacent_difference_async_direct(Policy l, ExPolicy&& p) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + auto result = tt::sync_wait(hpx::adjacent_difference( p.on(exec), std::begin(c), std::end(c), std::begin(d))); -#else - auto result = hpx::adjacent_difference( - p.on(exec), std::begin(c), std::end(c), std::begin(d)) | - tt::sync_wait(); -#endif + std::adjacent_difference(std::begin(c), std::end(c), std::begin(d_ans)); HPX_TEST(std::equal(std::begin(d), std::end(d), std::begin(d_ans), diff --git a/libs/core/algorithms/tests/unit/algorithms/adjacentfind_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/adjacentfind_tests.hpp index 5ea47b8d538..39918e10287 100644 --- a/libs/core/algorithms/tests/unit/algorithms/adjacentfind_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/adjacentfind_tests.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include @@ -52,6 +53,7 @@ void test_adjacent_find(ExPolicy policy, IteratorTag) HPX_TEST(index == iterator(test_index)); } +#if defined(HPX_HAVE_STDEXEC) template void test_adjacent_find_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -93,6 +95,7 @@ void test_adjacent_find_sender( HPX_TEST(iterator(std::begin(c)) == hpx::get<0>(*snd_result)); } +#endif template void test_adjacent_find_async(ExPolicy p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/all_of_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/all_of_tests.hpp index e86a8973d45..55e647388d5 100644 --- a/libs/core/algorithms/tests/unit/algorithms/all_of_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/all_of_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -67,6 +68,7 @@ void test_all_of(ExPolicy&& policy, IteratorTag) } } +#if defined(HPX_HAVE_STDEXEC) template void test_all_of_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -101,6 +103,7 @@ void test_all_of_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST_EQ(result, expected); } } +#endif template void test_all_of_ranges_seq(IteratorTag, Proj proj = Proj()) diff --git a/libs/core/algorithms/tests/unit/algorithms/any_of_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/any_of_tests.hpp index 3e7088f6f00..d327907515f 100644 --- a/libs/core/algorithms/tests/unit/algorithms/any_of_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/any_of_tests.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include #include @@ -67,6 +68,7 @@ void test_any_of(ExPolicy&& policy, IteratorTag) } } +#if defined(HPX_HAVE_STDEXEC) template void test_any_of_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -102,6 +104,7 @@ void test_any_of_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST_EQ(result, expected); } } +#endif template void test_any_of_ranges_seq(IteratorTag, Proj proj = Proj()) diff --git a/libs/core/algorithms/tests/unit/algorithms/copy_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/copy_tests.hpp index f8262c5394c..7a38b389c83 100644 --- a/libs/core/algorithms/tests/unit/algorithms/copy_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/copy_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -70,6 +71,7 @@ void test_copy(ExPolicy&& policy, IteratorTag) HPX_TEST_EQ(count, d.size()); } +#if defined(HPX_HAVE_STDEXEC) template void test_copy_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -103,6 +105,7 @@ void test_copy_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) })); HPX_TEST_EQ(count, d.size()); } +#endif template void test_copy_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/copyn_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/copyn_tests.hpp index 0192a61b49a..831acf622b9 100644 --- a/libs/core/algorithms/tests/unit/algorithms/copyn_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/copyn_tests.hpp @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include @@ -72,6 +73,7 @@ void test_copy_n(ExPolicy&& policy, IteratorTag) HPX_TEST_EQ(count, d.size()); } +#if defined(HPX_HAVE_STDEXEC) template void test_copy_n_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -108,6 +110,7 @@ void test_copy_n_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) })); HPX_TEST_EQ(count, d.size()); } +#endif template void test_copy_n_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/count_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/count_tests.hpp index b89037fb91d..77198a999ef 100644 --- a/libs/core/algorithms/tests/unit/algorithms/count_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/count_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -70,6 +71,7 @@ void test_count(ExPolicy&& policy, IteratorTag) HPX_TEST_EQ(num_items, static_cast(find_count)); } +#if defined(HPX_HAVE_STDEXEC) template void test_count_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -102,6 +104,7 @@ void test_count_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST_EQ(num_items, static_cast(find_count)); } +#endif template void test_count_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/countif_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/countif_tests.hpp index 8c3226f47a6..8f4d4db06c5 100644 --- a/libs/core/algorithms/tests/unit/algorithms/countif_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/countif_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -80,6 +81,7 @@ void test_count_if(ExPolicy&& policy, IteratorTag) HPX_TEST_EQ(num_items, 50u); } +#if defined(HPX_HAVE_STDEXEC) template void test_count_if_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -109,6 +111,7 @@ void test_count_if_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST_EQ(num_items, 50u); } +#endif template void test_count_if_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/destroy_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/destroy_tests.hpp index 81b99262fa9..0353e169ec3 100644 --- a/libs/core/algorithms/tests/unit/algorithms/destroy_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/destroy_tests.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include #include @@ -96,6 +97,7 @@ void test_destroy(ExPolicy&& policy, IteratorTag) std::free(p); } +#if defined(HPX_HAVE_STDEXEC) template void test_destroy_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -128,6 +130,7 @@ void test_destroy_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) std::free(p); } +#endif template void test_destroy_async(ExPolicy&& policy, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/equal_binary_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/equal_binary_tests.hpp index e9cdf409c5f..0ed54c46d79 100644 --- a/libs/core/algorithms/tests/unit/algorithms/equal_binary_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/equal_binary_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -462,6 +463,7 @@ void test_equal_binary_bad_alloc_async(ExPolicy&& p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_equal_binary_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -517,6 +519,7 @@ void test_equal_binary_sender( HPX_TEST_EQ(result, expected); } } +#endif //////////////////////////////////////////////////////////////////////////////// @@ -561,6 +564,7 @@ void test_equal_binary_edge_cases(ExPolicy&& policy, IteratorTag) } } +#if defined(HPX_HAVE_STDEXEC) template void test_equal_binary_edge_cases_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -629,3 +633,4 @@ void test_equal_binary_edge_cases_sender( HPX_TEST(!result); } } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/equal_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/equal_tests.hpp index 34681e10478..a1e53c46f16 100644 --- a/libs/core/algorithms/tests/unit/algorithms/equal_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/equal_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -102,6 +103,7 @@ void test_equal1(ExPolicy&& policy, IteratorTag) } } +#if defined(HPX_HAVE_STDEXEC) template void test_equal1_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -169,6 +171,7 @@ void test_equal1_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST(result); } } +#endif template void test_equal1_async(ExPolicy&& p, IteratorTag) @@ -291,6 +294,7 @@ void test_equal2(ExPolicy&& policy, IteratorTag) } } +#if defined(HPX_HAVE_STDEXEC) template void test_equal2_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -359,6 +363,7 @@ void test_equal2_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST(result); } } +#endif template void test_equal2_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/fill_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/fill_tests.hpp index 09d8d0b317d..c1af2876ef2 100644 --- a/libs/core/algorithms/tests/unit/algorithms/fill_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/fill_tests.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include @@ -68,6 +69,7 @@ void test_fill(ExPolicy policy, IteratorTag) HPX_TEST_EQ(count, c.size()); } +#if defined(HPX_HAVE_STDEXEC) template void test_fill_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -97,6 +99,7 @@ void test_fill_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) }); HPX_TEST_EQ(count, c.size()); } +#endif template void test_fill_async(ExPolicy p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/filln_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/filln_tests.hpp index d8acda3cd2c..f33ee5d945d 100644 --- a/libs/core/algorithms/tests/unit/algorithms/filln_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/filln_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -67,6 +68,7 @@ void test_fill_n(ExPolicy policy, IteratorTag) HPX_TEST_EQ(count, c.size()); } +#if defined(HPX_HAVE_STDEXEC) template void test_fill_n_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -96,6 +98,7 @@ void test_fill_n_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) }); HPX_TEST_EQ(count, c.size()); } +#endif template void test_fill_n_async(ExPolicy p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/find_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/find_tests.hpp index 9f9107c44d7..c6552809211 100644 --- a/libs/core/algorithms/tests/unit/algorithms/find_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/find_tests.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include #include @@ -69,6 +70,7 @@ void test_find(ExPolicy&& policy, IteratorTag) HPX_TEST(index == iterator(test_index)); } +#if defined(HPX_HAVE_STDEXEC) template void test_find_explicit_sender_direct(Policy l, ExPolicy&& policy, IteratorTag) { @@ -117,20 +119,17 @@ void test_find_explicit_sender(Policy l, ExPolicy&& policy, IteratorTag) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + auto result = tt::sync_wait( ex::just(iterator(std::begin(c)), iterator(std::end(c)), int(1)) | hpx::find(policy.on(exec))); -#else - auto result = - ex::just(iterator(std::begin(c)), iterator(std::end(c)), int(1)) | - hpx::find(policy.on(exec)) | tt::sync_wait(); -#endif + base_iterator test_index = std::begin(c) + c.size() / 2; HPX_TEST(hpx::get<0>(*result) == iterator(test_index)); } +#endif template void test_find_async(ExPolicy&& p, IteratorTag) @@ -156,6 +155,7 @@ void test_find_async(ExPolicy&& p, IteratorTag) HPX_TEST(f.get() == iterator(test_index)); } +#if defined(HPX_HAVE_STDEXEC) template void test_find_explicit_sender_direct_async(Policy l, ExPolicy&& p, IteratorTag) { @@ -176,19 +176,16 @@ void test_find_explicit_sender_direct_async(Policy l, ExPolicy&& p, IteratorTag) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + auto result = tt::sync_wait(hpx::find( p.on(exec), iterator(std::begin(c)), iterator(std::end(c)), int(1))); -#else - auto result = hpx::find(p.on(exec), iterator(std::begin(c)), - iterator(std::end(c)), int(1)) | - tt::sync_wait(); -#endif + // create iterator at position of value to be found base_iterator test_index = std::begin(c) + c.size() / 2; HPX_TEST(hpx::get<0>(*result) == iterator(test_index)); } +#endif /////////////////////////////////////////////////////////////////////////////// template diff --git a/libs/core/algorithms/tests/unit/algorithms/findend_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/findend_tests.hpp index 4984f5593f6..bdc8d54daa1 100644 --- a/libs/core/algorithms/tests/unit/algorithms/findend_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/findend_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -78,6 +79,7 @@ void test_find_end1(ExPolicy&& policy, IteratorTag) HPX_TEST(index == test_index); } +#if defined(HPX_HAVE_STDEXEC) template void test_find_end1_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -129,6 +131,7 @@ void test_find_end1_sender( hpx::find_end(ex_policy.on(exec))); HPX_TEST(iterator(std::begin(c)) == hpx::get<0>(*snd_result)); } +#endif template void test_find_end1_async(ExPolicy&& p, IteratorTag) @@ -210,6 +213,7 @@ void test_find_end2(ExPolicy&& policy, IteratorTag) HPX_TEST(index == test_index); } +#if defined(HPX_HAVE_STDEXEC) template void test_find_end2_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -249,6 +253,7 @@ void test_find_end2_sender( HPX_TEST(index == test_index); } +#endif template void test_find_end2_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/findfirstof_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/findfirstof_tests.hpp index ffa6002f0fd..21b6139223e 100644 --- a/libs/core/algorithms/tests/unit/algorithms/findfirstof_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/findfirstof_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -73,6 +74,7 @@ void test_find_first_of(ExPolicy&& policy, IteratorTag) HPX_TEST(index == iterator(test_index)); } +#if defined(HPX_HAVE_STDEXEC) template void test_find_first_of_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -108,6 +110,7 @@ void test_find_first_of_sender( HPX_TEST(index == iterator(test_index)); } +#endif template void test_find_first_of_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/findif_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/findif_tests.hpp index cfcba721e72..678d9ad7294 100644 --- a/libs/core/algorithms/tests/unit/algorithms/findif_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/findif_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -66,6 +67,7 @@ void test_find_if(ExPolicy&& policy, IteratorTag) HPX_TEST(index == iterator(test_index)); } +#if defined(HPX_HAVE_STDEXEC) template void test_find_if_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -97,6 +99,7 @@ void test_find_if_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST(index == iterator(test_index)); } +#endif template void test_find_if_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/findifnot_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/findifnot_tests.hpp index 1d312eb2b19..6cacbf3b0a0 100644 --- a/libs/core/algorithms/tests/unit/algorithms/findifnot_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/findifnot_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -65,6 +66,7 @@ void test_find_if_not(ExPolicy&& policy, IteratorTag) HPX_TEST(index == iterator(test_index)); } +#if defined(HPX_HAVE_STDEXEC) template void test_find_if_not_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -97,6 +99,7 @@ void test_find_if_not_sender( HPX_TEST(index == iterator(test_index)); } +#endif template void test_find_if_not_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/foreach_sender.cpp b/libs/core/algorithms/tests/unit/algorithms/foreach_sender.cpp index de5199e58d2..64c9cef8322 100644 --- a/libs/core/algorithms/tests/unit/algorithms/foreach_sender.cpp +++ b/libs/core/algorithms/tests/unit/algorithms/foreach_sender.cpp @@ -73,14 +73,10 @@ void test_for_each_explicit_sender_direct_async( using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + auto result = tt::sync_wait(hpx::for_each( policy.on(exec), iterator(std::begin(c)), iterator(std::end(c)), f)); -#else - auto result = hpx::for_each(policy.on(exec), iterator(std::begin(c)), - iterator(std::end(c)), f) | - tt::sync_wait(); -#endif + HPX_TEST(hpx::get<0>(*result) == iterator(std::end(c))); // verify values @@ -113,14 +109,11 @@ void test_for_each_explicit_sender(Policy l, ExPolicy&& policy, IteratorTag) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + auto result = tt::sync_wait( ex::just(iterator(std::begin(c)), iterator(std::end(c)), f) | hpx::for_each(policy.on(exec))); -#else - auto result = ex::just(iterator(std::begin(c)), iterator(std::end(c)), f) | - hpx::for_each(policy.on(exec)) | tt::sync_wait(); -#endif + HPX_TEST(hpx::get<0>(*result) == iterator(std::end(c))); // verify values diff --git a/libs/core/algorithms/tests/unit/algorithms/foreach_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/foreach_tests.hpp index 72180608e15..a919f8e8354 100644 --- a/libs/core/algorithms/tests/unit/algorithms/foreach_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/foreach_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -371,6 +372,7 @@ void test_for_each_n(ExPolicy policy, IteratorTag) HPX_TEST_EQ(count, c.size()); } +#if defined(HPX_HAVE_STDEXEC) template void test_for_each_n_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -407,6 +409,7 @@ void test_for_each_n_sender( }); HPX_TEST_EQ(count, c.size()); } +#endif template void test_for_each_n_async(ExPolicy p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/generate_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/generate_tests.hpp index c25d54b9947..9549e79d937 100644 --- a/libs/core/algorithms/tests/unit/algorithms/generate_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/generate_tests.hpp @@ -9,6 +9,7 @@ #pragma once #include +#include #include #include @@ -69,6 +70,7 @@ void test_generate(ExPolicy&& policy, IteratorTag) HPX_TEST_EQ(count, c.size()); } +#if defined(HPX_HAVE_STDEXEC) template void test_generate_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -100,6 +102,7 @@ void test_generate_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) }); HPX_TEST_EQ(count, c.size()); } +#endif template void test_generate_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/generaten_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/generaten_tests.hpp index c14b253118f..0880d54df06 100644 --- a/libs/core/algorithms/tests/unit/algorithms/generaten_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/generaten_tests.hpp @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include @@ -65,6 +66,7 @@ void test_generate_n(ExPolicy&& policy, IteratorTag) HPX_TEST_EQ(count, c.size()); } +#if defined(HPX_HAVE_STDEXEC) template void test_generate_n_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -96,6 +98,7 @@ void test_generate_n_sender( }); HPX_TEST_EQ(count, c.size()); } +#endif template void test_generate_n_async(ExPolicy&& p, IteratorTag) diff --git a/libs/core/algorithms/tests/unit/algorithms/is_heap_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/is_heap_tests.hpp index 7e3cf0edabf..f7321239955 100644 --- a/libs/core/algorithms/tests/unit/algorithms/is_heap_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/is_heap_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -140,6 +141,7 @@ void test_is_heap( } } +#if defined(HPX_HAVE_STDEXEC) template void test_is_heap_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -161,8 +163,8 @@ void test_is_heap_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) std::make_heap(std::begin(c), heap_end_iter); { - auto snd_result = - tt::sync_wait(ex::just(iterator(std::begin(c)), iterator(std::end(c))) | + auto snd_result = tt::sync_wait( + ex::just(iterator(std::begin(c)), iterator(std::end(c))) | hpx::is_heap(ex_policy.on(exec))); bool result = hpx::get<0>(*snd_result); @@ -175,8 +177,8 @@ void test_is_heap_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { // edge case: empty range - auto snd_result = - tt::sync_wait(ex::just(iterator(std::begin(c)), iterator(std::begin(c))) | + auto snd_result = tt::sync_wait( + ex::just(iterator(std::begin(c)), iterator(std::begin(c))) | hpx::is_heap(ex_policy.on(exec))); bool result = hpx::get<0>(*snd_result); @@ -190,8 +192,8 @@ void test_is_heap_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { // edge case: range with only one element - auto snd_result = - tt::sync_wait(ex::just(iterator(std::begin(c)), iterator(++std::begin(c))) | + auto snd_result = tt::sync_wait( + ex::just(iterator(std::begin(c)), iterator(++std::begin(c))) | hpx::is_heap(ex_policy.on(exec))); bool result = hpx::get<0>(*snd_result); @@ -265,8 +267,8 @@ void test_is_heap_until_sender( HPX_TEST(result.base() == ++std::begin(c)); HPX_TEST(result.base() == solution); } - } +#endif template void test_is_heap_with_pred( diff --git a/libs/core/algorithms/tests/unit/algorithms/is_sorted_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/is_sorted_tests.hpp index 63c40cfc18d..93ffc4a86a8 100644 --- a/libs/core/algorithms/tests/unit/algorithms/is_sorted_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/is_sorted_tests.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include @@ -421,6 +422,7 @@ void test_sorted_bad_alloc_seq(IteratorTag) HPX_TEST(caught_bad_alloc); } +#if defined(HPX_HAVE_STDEXEC) template void test_is_sorted_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -473,3 +475,4 @@ void test_is_sorted_sender( HPX_TEST(is_ordered); } } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/mismatch_binary_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/mismatch_binary_tests.hpp index dc3c5fc70da..f1f8ef044ba 100644 --- a/libs/core/algorithms/tests/unit/algorithms/mismatch_binary_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/mismatch_binary_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -481,6 +482,7 @@ void test_mismatch_binary_bad_alloc_async(ExPolicy&& p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_mismatch_binary1_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -609,3 +611,4 @@ void test_mismatch_binary2_sender( HPX_TEST(result.second == std::begin(c2)); } } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/mismatch_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/mismatch_tests.hpp index ede7759918c..306babdce10 100644 --- a/libs/core/algorithms/tests/unit/algorithms/mismatch_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/mismatch_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -478,6 +479,7 @@ void test_mismatch_bad_alloc_async(ExPolicy&& p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_mismatch_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -551,3 +553,4 @@ void test_mismatch_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST(result.second == std::begin(c2)); } } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/none_of_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/none_of_tests.hpp index 459d97de478..aff9a3284e6 100644 --- a/libs/core/algorithms/tests/unit/algorithms/none_of_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/none_of_tests.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include #include @@ -67,6 +68,7 @@ void test_none_of(ExPolicy&& policy, IteratorTag) } } +#if defined(HPX_HAVE_STDEXEC) template void test_none_of_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -101,6 +103,7 @@ void test_none_of_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST_EQ(result, expected); } } +#endif template void test_none_of_ranges_seq(IteratorTag, Proj proj = Proj()) diff --git a/libs/core/algorithms/tests/unit/algorithms/reduce_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/reduce_tests.hpp index ff7afad0de8..3419c3bc8b5 100644 --- a/libs/core/algorithms/tests/unit/algorithms/reduce_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/reduce_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -342,6 +343,7 @@ void test_reduce_bad_alloc_async(ExPolicy p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_reduce_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -384,3 +386,4 @@ void test_reduce_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST_EQ(res, val); } } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/remove_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/remove_tests.hpp index 1593f5add23..9a9d0edcdaa 100644 --- a/libs/core/algorithms/tests/unit/algorithms/remove_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/remove_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -691,6 +692,7 @@ void test_remove_bad_alloc(bool test_for_remove_if = false) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_remove_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -764,3 +766,4 @@ void test_remove_if_sender( HPX_TEST(equality); } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/reverse_sender.cpp b/libs/core/algorithms/tests/unit/algorithms/reverse_sender.cpp index 6e5b76e4263..630bb05a273 100644 --- a/libs/core/algorithms/tests/unit/algorithms/reverse_sender.cpp +++ b/libs/core/algorithms/tests/unit/algorithms/reverse_sender.cpp @@ -79,13 +79,9 @@ void test_reverse(Policy l, ExPolicy&& policy, IteratorTag) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + tt::sync_wait(ex::just(iterator(std::begin(c)), iterator(std::end(c))) | hpx::reverse(policy.on(exec))); -#else - ex::just(iterator(std::begin(c)), iterator(std::end(c))) | - hpx::reverse(policy.on(exec)) | tt::sync_wait(); -#endif std::reverse(std::begin(d1), std::end(d1)); @@ -117,13 +113,10 @@ void test_reverse_async_direct(Policy l, ExPolicy&& p, IteratorTag) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + tt::sync_wait(hpx::reverse( p.on(exec), iterator(std::begin(c)), iterator(std::end(c)))); -#else - hpx::reverse(p.on(exec), iterator(std::begin(c)), iterator(std::end(c))) | - tt::sync_wait(); -#endif + std::reverse(std::begin(d1), std::end(d1)); diff --git a/libs/core/algorithms/tests/unit/algorithms/rotate_sender.cpp b/libs/core/algorithms/tests/unit/algorithms/rotate_sender.cpp index f071f2bead3..d3b5efb595b 100644 --- a/libs/core/algorithms/tests/unit/algorithms/rotate_sender.cpp +++ b/libs/core/algorithms/tests/unit/algorithms/rotate_sender.cpp @@ -95,14 +95,11 @@ void test_rotate(Policy l, ExPolicy&& policy, IteratorTag) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + tt::sync_wait(ex::just(iterator(std::begin(c)), iterator(mid), iterator(std::end(c))) | hpx::rotate(policy.on(exec))); -#else - ex::just(iterator(std::begin(c)), iterator(mid), iterator(std::end(c))) | - hpx::rotate(policy.on(exec)) | tt::sync_wait(); -#endif + base_iterator mid1 = std::begin(d1); std::advance(mid1, mid_pos); @@ -141,14 +138,9 @@ void test_rotate_async_direct(Policy l, ExPolicy&& p, IteratorTag) using scheduler_t = ex::thread_pool_policy_scheduler; auto exec = ex::explicit_scheduler_executor(scheduler_t(l)); -#ifdef HPX_HAVE_STDEXEC + tt::sync_wait(hpx::rotate(p.on(exec), iterator(std::begin(c)), iterator(mid), iterator(std::end(c)))); -#else - hpx::rotate(p.on(exec), iterator(std::begin(c)), iterator(mid), - iterator(std::end(c))) | - tt::sync_wait(); -#endif base_iterator mid1 = std::begin(d1); std::advance(mid1, mid_pos); diff --git a/libs/core/algorithms/tests/unit/algorithms/transform_binary2_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/transform_binary2_tests.hpp index 1e0e1c191b3..f6bf88159b0 100644 --- a/libs/core/algorithms/tests/unit/algorithms/transform_binary2_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/transform_binary2_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -350,6 +351,7 @@ void test_transform_binary2_bad_alloc_async(ExPolicy p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_transform_binary2_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -399,3 +401,4 @@ void test_transform_binary2_sender( })); HPX_TEST_EQ(count, d2.size()); } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/transform_binary_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/transform_binary_tests.hpp index 58134ba16a3..bcfef1ae967 100644 --- a/libs/core/algorithms/tests/unit/algorithms/transform_binary_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/transform_binary_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -339,6 +340,7 @@ void test_transform_binary_bad_alloc_async(ExPolicy p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_transform_binary_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -386,3 +388,4 @@ void test_transform_binary_sender( })); HPX_TEST_EQ(count, d2.size()); } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/transform_reduce_binary_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/transform_reduce_binary_tests.hpp index 603cdeb714e..97bc3f1fd01 100644 --- a/libs/core/algorithms/tests/unit/algorithms/transform_reduce_binary_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/transform_reduce_binary_tests.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include #include @@ -84,6 +85,7 @@ void test_transform_reduce_binary_async(ExPolicy&& p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_transform_reduce_binary_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -132,3 +134,4 @@ void test_transform_reduce_binary_sender( std::begin(c), std::begin(c), std::begin(d), init)); } } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/transform_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/transform_tests.hpp index 59c558c1229..a45edbd2ce5 100644 --- a/libs/core/algorithms/tests/unit/algorithms/transform_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/transform_tests.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -301,6 +302,7 @@ void test_transform_bad_alloc_async(ExPolicy p, IteratorTag) //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_transform_sender( LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) @@ -340,3 +342,4 @@ void test_transform_sender( })); HPX_TEST_EQ(count, d.size()); } +#endif diff --git a/libs/core/algorithms/tests/unit/algorithms/unique_tests.hpp b/libs/core/algorithms/tests/unit/algorithms/unique_tests.hpp index a4c4c97c3a8..83a594d7ada 100644 --- a/libs/core/algorithms/tests/unit/algorithms/unique_tests.hpp +++ b/libs/core/algorithms/tests/unit/algorithms/unique_tests.hpp @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -503,6 +504,7 @@ void test_unique_bad_alloc() } //////////////////////////////////////////////////////////////////////////////// +#if defined(HPX_HAVE_STDEXEC) template void test_unique_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) { @@ -571,3 +573,4 @@ void test_unique_sender(LnPolicy ln_policy, ExPolicy&& ex_policy, IteratorTag) HPX_TEST(equality); } } +#endif