Skip to content

Commit 14aeb4a

Browse files
Apply CREATE_NEW_POLICY macro in tests
1 parent c481236 commit 14aeb4a

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

test/parallel_api/ranges/adjacent_find_ranges_sycl.pass.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
#endif
2323

2424
#include "support/utils.h"
25+
#include "support/utils_invoke.h" // CREATE_NEW_POLICY
2526

2627
#include <iostream>
2728

28-
std::int32_t
29-
main()
30-
{
3129
#if _ENABLE_RANGES_TESTING
30+
template <typename Policy>
31+
void test(Policy&& exec)
32+
{
3233
constexpr int n = 10;
3334
int data[n] = {5, 6, 7, 3, 4, 5, 6, 7, 8, 9};
3435

@@ -40,18 +41,29 @@ main()
4041
{
4142
sycl::buffer<int> A(data, sycl::range<1>(n));
4243

43-
auto exec = TestUtils::default_dpcpp_policy;
44-
using Policy = decltype(exec);
45-
auto exec1 = TestUtils::make_new_policy<TestUtils::new_kernel_name<Policy, 0>>(exec);
46-
auto exec2 = TestUtils::make_new_policy<TestUtils::new_kernel_name<Policy, 1>>(exec);
47-
48-
res1 = adjacent_find(exec1, views::all_read(A));
49-
res2 = adjacent_find(exec2, A, [](auto a, auto b) {return a == b;});
44+
res1 = adjacent_find(CREATE_NEW_POLICY(exec, 0), views::all_read(A));
45+
res2 = adjacent_find(CREATE_NEW_POLICY(exec, 1), A, [](auto a, auto b) {return a == b;});
5046
}
5147

5248
//check result
5349
EXPECT_TRUE(res1 == idx, "wrong effect from 'adjacent_find', sycl ranges");
5450
EXPECT_TRUE(res2 == idx, "wrong effect from 'adjacent_find' with predicate, sycl ranges");
51+
}
52+
#endif // _ENABLE_RANGES_TESTING
53+
54+
std::int32_t
55+
main()
56+
{
57+
#if _ENABLE_RANGES_TESTING
58+
59+
auto q = TestUtils::get_test_queue();
60+
61+
auto policy = TestUtils::make_new_policy<class Kernel1>(q);
62+
test(policy);
63+
64+
const auto& policy_ref = policy;
65+
test(policy_ref);
66+
5567
#endif //_ENABLE_RANGES_TESTING
5668

5769
return TestUtils::done(_ENABLE_RANGES_TESTING);

0 commit comments

Comments
 (0)