Skip to content

Commit

Permalink
[oneDPL][ranges][test] + support arbitrary n for ranges tests (#1908)
Browse files Browse the repository at this point in the history
* [oneDPL][ranges][test] + support arbitrary n for 'data_in' test mode

* [oneDPL][ranges][test] + support arbitrary n for 'data_in_out' test mode

* [oneDPL][ranges][test] + big data size cases

* [oneDPL][ranges][test] + support arbitrary n for 'data_in_in' test mode

* [oneDPL][ranges][test] + support arbitrary n for 'data_in_in_out' test mode

* [oneDPL][ranges][test] + big data size test cases

* [oneDPL][ranges][test] corrected number of element for the algo result checks

* [oneDPL][ranges][test] + big_sz as one shared constant for the all tests

* [oneDPL][ranges][tests] + fixes for arbitrary n support

* [oneDPL][ranges][tests] + comment for static_assert(std::is_trivially_copyable_v<T>
  • Loading branch information
MikeDvorskiy authored Oct 23, 2024
1 parent deaff18 commit dad8134
Show file tree
Hide file tree
Showing 25 changed files with 155 additions and 115 deletions.
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_adjacent_find.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::adjacent_find, std::ranges::adjacent_find, binary_pred);
test_range_algo<0>{big_sz}(dpl_ranges::adjacent_find, std::ranges::adjacent_find, binary_pred);
test_range_algo<1>{}(dpl_ranges::adjacent_find, std::ranges::adjacent_find, binary_pred, proj);
test_range_algo<2, P2>{}(dpl_ranges::adjacent_find, std::ranges::adjacent_find, binary_pred, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::adjacent_find, std::ranges::adjacent_find, binary_pred, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_all_of.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::all_of, std::ranges::all_of, pred1);
test_range_algo<0>{big_sz}(dpl_ranges::all_of, std::ranges::all_of, pred1);
test_range_algo<1>{}(dpl_ranges::all_of, std::ranges::all_of, pred1, proj);
test_range_algo<2, P2>{}(dpl_ranges::all_of, std::ranges::all_of, pred1, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::all_of, std::ranges::all_of, pred1, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_any_of.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::any_of, std::ranges::any_of, pred2);
test_range_algo<0>{big_sz}(dpl_ranges::any_of, std::ranges::any_of, pred2);
test_range_algo<1>{}(dpl_ranges::any_of, std::ranges::any_of, pred2, proj);
test_range_algo<2, P2>{}(dpl_ranges::any_of, std::ranges::any_of, pred2, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::any_of, std::ranges::any_of, pred2, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_copy.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ main()
return ret_type{std::ranges::begin(r_in) + size, std::ranges::begin(r_out) + size};
};

test_range_algo<0, int, data_in_out_lim>{}(dpl_ranges::copy, copy_checker);
test_range_algo<0, int, data_in_out_lim>{big_sz}(dpl_ranges::copy, copy_checker);

#endif //_ENABLE_STD_RANGES_TESTING

Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_copy_if.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ main()
return ret_type{res.in, res.out};
};

test_range_algo<0, int, data_in_out>{}(dpl_ranges::copy_if, copy_if_checker, pred);
test_range_algo<0, int, data_in_out>{big_sz}(dpl_ranges::copy_if, copy_if_checker, pred);
test_range_algo<1, int, data_in_out>{}(dpl_ranges::copy_if, copy_if_checker, pred, proj);
test_range_algo<2, P2, data_in_out>{}(dpl_ranges::copy_if, copy_if_checker, pred, &P2::x);
test_range_algo<3, P2, data_in_out>{}(dpl_ranges::copy_if, copy_if_checker, pred, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_count.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::count, std::ranges::count, 4);
test_range_algo<0>{big_sz}(dpl_ranges::count, std::ranges::count, 4);
test_range_algo<1>{}(dpl_ranges::count, std::ranges::count, 4, proj);
test_range_algo<2, P2>{}(dpl_ranges::count, std::ranges::count, 4, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::count, std::ranges::count, 4, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_count_if.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::count_if, std::ranges::count_if, pred);
test_range_algo<0>{big_sz}(dpl_ranges::count_if, std::ranges::count_if, pred);
test_range_algo<1>{}(dpl_ranges::count_if, std::ranges::count_if, pred, proj);
test_range_algo<2, P2>{}(dpl_ranges::count_if, std::ranges::count_if, pred, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::count_if, std::ranges::count_if, pred, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_equal.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0, int, data_in_in>{}(dpl_ranges::equal, std::ranges::equal, binary_pred);
test_range_algo<0, int, data_in_in>{big_sz}(dpl_ranges::equal, std::ranges::equal, binary_pred);
test_range_algo<1, int, data_in_in>{}(dpl_ranges::equal, std::ranges::equal, binary_pred, proj, proj);
test_range_algo<2, P2, data_in_in>{}(dpl_ranges::equal, std::ranges::equal, binary_pred, &P2::x, &P2::x);
test_range_algo<3, P2, data_in_in>{}(dpl_ranges::equal, std::ranges::equal, binary_pred, &P2::proj, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_find.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::find, std::ranges::find, 4); //found case
test_range_algo<0>{big_sz}(dpl_ranges::find, std::ranges::find, 4); //found case
test_range_algo<1>{}(dpl_ranges::find, std::ranges::find, -1); //not found case
test_range_algo<2>{}(dpl_ranges::find, std::ranges::find, 4, proj);
test_range_algo<3, P2>{}(dpl_ranges::find, std::ranges::find, 4, &P2::x);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_find_if.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::find_if, std::ranges::find_if, pred);
test_range_algo<0>{big_sz}(dpl_ranges::find_if, std::ranges::find_if, pred);
test_range_algo<1>{}(dpl_ranges::find_if, std::ranges::find_if, pred, proj);
test_range_algo<2, P2>{}(dpl_ranges::find_if, std::ranges::find_if, pred, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::find_if, std::ranges::find_if, pred, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_find_if_not.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::find_if_not, std::ranges::find_if_not, pred1);
test_range_algo<0>{big_sz}(dpl_ranges::find_if_not, std::ranges::find_if_not, pred1);
test_range_algo<1>{}(dpl_ranges::find_if_not, std::ranges::find_if_not, pred, proj);
test_range_algo<2, P2>{}(dpl_ranges::find_if_not, std::ranges::find_if_not, pred, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::find_if_not, std::ranges::find_if_not, pred, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_for_each.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ main()
return res.in;
};

test_range_algo<0>{}(dpl_ranges::for_each, for_each_checker, f_mutuable);
test_range_algo<0>{big_sz}(dpl_ranges::for_each, for_each_checker, f_mutuable);
test_range_algo<1>{}(dpl_ranges::for_each, for_each_checker, f_mutuable, proj_mutuable);
test_range_algo<2, P2>{}(dpl_ranges::for_each, for_each_checker, f_mutuable, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::for_each, for_each_checker, f_mutuable, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_is_sorted.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::is_sorted, std::ranges::is_sorted, std::ranges::less{});
test_range_algo<0>{big_sz}(dpl_ranges::is_sorted, std::ranges::is_sorted, std::ranges::less{});

test_range_algo<1>{}(dpl_ranges::is_sorted, std::ranges::is_sorted, std::ranges::less{}, proj);
test_range_algo<2, P2>{}(dpl_ranges::is_sorted, std::ranges::is_sorted, std::ranges::less{}, &P2::x);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_max_element.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::max_element, std::ranges::max_element, std::ranges::less{});
test_range_algo<0>{big_sz}(dpl_ranges::max_element, std::ranges::max_element, std::ranges::less{});
test_range_algo<1>{}(dpl_ranges::max_element, std::ranges::max_element, std::ranges::less{}, proj);
test_range_algo<2, P2>{}(dpl_ranges::max_element, std::ranges::max_element, std::ranges::less{}, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::max_element, std::ranges::max_element, std::ranges::less{}, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_merge.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ main()
return ret_type{res.in1, res.in2, res.out};
};

test_range_algo<0, int, data_in_in_out>{}(dpl_ranges::merge, merge_checker, std::ranges::less{});
test_range_algo<0, int, data_in_in_out>{big_sz}(dpl_ranges::merge, merge_checker, std::ranges::less{});

test_range_algo<1, int, data_in_in_out>{}(dpl_ranges::merge, merge_checker, std::ranges::less{}, proj, proj);
test_range_algo<2, P2, data_in_in_out>{}(dpl_ranges::merge, merge_checker, std::ranges::less{}, &P2::x, &P2::x);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_min_element.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::min_element, std::ranges::min_element, std::ranges::less{});
test_range_algo<0>{big_sz}(dpl_ranges::min_element, std::ranges::min_element, std::ranges::less{});

test_range_algo<1>{}(dpl_ranges::min_element, std::ranges::min_element, std::ranges::less{}, proj);
test_range_algo<2, P2>{}(dpl_ranges::min_element, std::ranges::min_element, std::ranges::less{}, &P2::x);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_none_of.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::none_of, std::ranges::none_of, pred3);
test_range_algo<0>{big_sz}(dpl_ranges::none_of, std::ranges::none_of, pred3);
test_range_algo<1>{}(dpl_ranges::none_of, std::ranges::none_of, pred2, proj);
test_range_algo<2, P2>{}(dpl_ranges::none_of, std::ranges::none_of, pred3, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::none_of, std::ranges::none_of, pred3, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_search.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0, int, data_in_in>{}(dpl_ranges::search, std::ranges::search, binary_pred);
test_range_algo<0, int, data_in_in>{big_sz}(dpl_ranges::search, std::ranges::search, binary_pred);
test_range_algo<1, int, data_in_in>{}(dpl_ranges::search, std::ranges::search, binary_pred, proj, proj);
test_range_algo<2, P2, data_in_in>{}(dpl_ranges::search, std::ranges::search, binary_pred, &P2::x, &P2::x);
test_range_algo<3, P2, data_in_in>{}(dpl_ranges::search, std::ranges::search, binary_pred, &P2::proj, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_search_n.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::search_n, std::ranges::search_n, 1, 5, binary_pred);
test_range_algo<0>{big_sz}(dpl_ranges::search_n, std::ranges::search_n, 1, 5, binary_pred);
test_range_algo<1>{}(dpl_ranges::search_n, std::ranges::search_n, 3, 5, binary_pred, proj);
test_range_algo<2, P2>{}(dpl_ranges::search_n, std::ranges::search_n, 1, 2, binary_pred, &P2::x);
test_range_algo<3, P2>{}(dpl_ranges::search_n, std::ranges::search_n, 3, 5, binary_pred, &P2::proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_sort.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::sort, std::ranges::sort);
test_range_algo<0>{big_sz}(dpl_ranges::sort, std::ranges::sort);
test_range_algo<1>{}(dpl_ranges::sort, std::ranges::sort, std::ranges::less{});

test_range_algo<2>{}(dpl_ranges::sort, std::ranges::sort, std::ranges::less{}, proj);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_api/ranges/std_ranges_stable_sort.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main()
using namespace test_std_ranges;
namespace dpl_ranges = oneapi::dpl::ranges;

test_range_algo<0>{}(dpl_ranges::stable_sort, std::ranges::stable_sort);
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{});

test_range_algo<2>{}(dpl_ranges::stable_sort, std::ranges::stable_sort, std::ranges::less{}, proj);
Expand Down
Loading

0 comments on commit dad8134

Please sign in to comment.