From 6f8de9bf488d8c18eeb6c13b964c94de6de3c40a Mon Sep 17 00:00:00 2001 From: MikeDvorskiy Date: Wed, 23 Oct 2024 18:49:19 +0200 Subject: [PATCH] [oneDPL][ranges][tests] a fix for std::ranges::stable_sort usage for windows standard C++ library --- .../ranges/std_ranges_stable_sort.pass.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/parallel_api/ranges/std_ranges_stable_sort.pass.cpp b/test/parallel_api/ranges/std_ranges_stable_sort.pass.cpp index 8acbaf3ef3a..b8ff08faf9d 100644 --- a/test/parallel_api/ranges/std_ranges_stable_sort.pass.cpp +++ b/test/parallel_api/ranges/std_ranges_stable_sort.pass.cpp @@ -22,17 +22,24 @@ main() using namespace test_std_ranges; namespace dpl_ranges = oneapi::dpl::ranges; - test_range_algo<0>{big_sz}(dpl_ranges::stable_sort, std::ranges::stable_sort); - test_range_algo<1>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::less{}); + auto sort_stable_checker = +#if _ONEDPL_STD_RANGES_ALGO_CPP_FUN + [](auto&&... __args) { return std::ranges::stable_sort(std::forward(__args)...); }; +#else + std::ranges::stable_sort; +#endif - test_range_algo<2>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::less{}, proj); - test_range_algo<3>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::greater{}, proj); + test_range_algo<0>{big_sz}(dpl_ranges::stable_sort, sort_stable_checker); + test_range_algo<1>{}(dpl_ranges::stable_sort, sort_stable_checker, std::ranges::less{}); - test_range_algo<4, P2>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::less{}, &P2::x); - test_range_algo<5, P2>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::greater{}, &P2::x); + test_range_algo<2>{}(dpl_ranges::stable_sort, sort_stable_checker, std::ranges::less{}, proj); + test_range_algo<3>{}(dpl_ranges::stable_sort, sort_stable_checker, std::ranges::greater{}, proj); - test_range_algo<6, P2>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::less{}, &P2::proj); - test_range_algo<7, P2>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::greater{}, &P2::proj); + test_range_algo<4, P2>{}(dpl_ranges::stable_sort, sort_stable_checker, std::ranges::less{}, &P2::x); + test_range_algo<5, P2>{}(dpl_ranges::stable_sort, sort_stable_checker, std::ranges::greater{}, &P2::x); + + test_range_algo<6, P2>{}(dpl_ranges::stable_sort, sort_stable_checker, std::ranges::less{}, &P2::proj); + test_range_algo<7, P2>{}(dpl_ranges::stable_sort, sort_stable_checker, std::ranges::greater{}, &P2::proj); #endif //_ENABLE_STD_RANGES_TESTING return TestUtils::done(_ENABLE_STD_RANGES_TESTING);