22
22
#endif
23
23
24
24
#include " support/utils.h"
25
+ #include " support/utils_invoke.h" // CREATE_NEW_POLICY
25
26
26
27
#include < iostream>
27
28
28
- std::int32_t
29
- main ()
30
- {
31
29
#if _ENABLE_RANGES_TESTING
30
+ template <typename Policy>
31
+ void test (Policy&& exec)
32
+ {
32
33
constexpr int n = 10 ;
33
34
int data[n] = {5 , 6 , 7 , 3 , 4 , 5 , 6 , 7 , 8 , 9 };
34
35
@@ -40,18 +41,29 @@ main()
40
41
{
41
42
sycl::buffer<int > A (data, sycl::range<1 >(n));
42
43
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;});
50
46
}
51
47
52
48
// check result
53
49
EXPECT_TRUE (res1 == idx, " wrong effect from 'adjacent_find', sycl ranges" );
54
50
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
+
55
67
#endif // _ENABLE_RANGES_TESTING
56
68
57
69
return TestUtils::done (_ENABLE_RANGES_TESTING);
0 commit comments