diff --git a/test/parallel_api/numeric/numeric.ops/scan_2.pass.cpp b/test/parallel_api/numeric/numeric.ops/scan_2.pass.cpp index c93860ce2e5..f0f51f66a89 100644 --- a/test/parallel_api/numeric/numeric.ops/scan_2.pass.cpp +++ b/test/parallel_api/numeric/numeric.ops/scan_2.pass.cpp @@ -190,29 +190,38 @@ DEFINE_TEST_1(test_scan_non_inplace, TestingAlgoritm) EXPECT_EQ_N(expected.cbegin(), host_vals.get(), n, TestingAlgoritm().getMsg(false)); } + // specialization for host execution policies template - void + ::std::enable_if_t< + !oneapi::dpl::__internal::__is_hetero_execution_policy_v<::std::decay_t> && + is_base_of_iterator_category_v<::std::random_access_iterator_tag, Iterator1>> operator()(Policy&& exec, Iterator1 keys_first, Iterator1 keys_last, Iterator2 vals_first, Iterator2 vals_last, Size n) { - if constexpr (!oneapi::dpl::__internal::__is_hetero_execution_policy_v<::std::decay_t> && - is_base_of_iterator_category_v<::std::random_access_iterator_tag, Iterator1>) - { - using ValT = typename ::std::iterator_traits::value_type; + using ValT = typename ::std::iterator_traits::value_type; - TestingAlgoritm testingAlgo; + TestingAlgoritm testingAlgo; - // Initialize source data in the buffer [keys_first, keys_last) - initialize_data(keys_first, n); + // Initialize source data in the buffer [keys_first, keys_last) + initialize_data(keys_first, n); - testingAlgo.call_onedpl(exec, keys_first, keys_last, vals_first); + testingAlgo.call_onedpl(exec, keys_first, keys_last, vals_first); - std::vector expected(n); - testingAlgo.call_serial(keys_first, keys_last + n, expected.data()); - EXPECT_EQ_N(expected.cbegin(), vals_first, n, TestingAlgoritm().getMsg(false)); - } + std::vector expected(n); + testingAlgo.call_serial(keys_first, keys_last + n, expected.data()); + EXPECT_EQ_N(expected.cbegin(), vals_first, n, TestingAlgoritm().getMsg(false)); + } + + // specialization for non-random_access iterators + template + ::std::enable_if_t> + operator()(Policy&& exec, + Iterator1 keys_first, Iterator1 keys_last, + Iterator2 vals_first, Iterator2 vals_last, + Size n) + { } }; @@ -243,36 +252,42 @@ DEFINE_TEST_1(test_scan_inplace, TestingAlgoritm) EXPECT_EQ_N(expected.cbegin(), keys_first, n, testingAlgo.getMsg(true)); } + // specialization for hetero policy template - void + ::std::enable_if_t< + oneapi::dpl::__internal::__is_hetero_execution_policy_v<::std::decay_t> && + is_base_of_iterator_category_v<::std::random_access_iterator_tag, Iterator1>> operator()(Policy&& exec, Iterator1 keys_first, Iterator1 keys_last, Size n) { - if constexpr (oneapi::dpl::__internal::__is_hetero_execution_policy_v<::std::decay_t> && - is_base_of_iterator_category_v<::std::random_access_iterator_tag, Iterator1>) - { - using KeyT = typename ::std::iterator_traits::value_type; + using KeyT = typename ::std::iterator_traits::value_type; - TestingAlgoritm testingAlgo; + TestingAlgoritm testingAlgo; + + TestDataTransfer host_keys(*this, n); - TestDataTransfer host_keys(*this, n); + // Initialize source data in the buffer [keys_first, keys_last) + initialize_data(host_keys.get(), n); + const std::vector source_host_keys_state(host_keys.get(), host_keys.get() + n); - // Initialize source data in the buffer [keys_first, keys_last) - initialize_data(host_keys.get(), n); - const std::vector source_host_keys_state(host_keys.get(), host_keys.get() + n); + // Copy data from the buffer [keys_first, keys_last) to a device. + update_data(host_keys); - // Copy data from the buffer [keys_first, keys_last) to a device. - update_data(host_keys); + // Now we are ready to call tested algorithm + testingAlgo.call_onedpl(make_new_policy>(exec), keys_first, keys_last, keys_first); - // Now we are ready to call tested algorithm - testingAlgo.call_onedpl(make_new_policy>(exec), keys_first, keys_last, keys_first); + retrieve_data(host_keys); - retrieve_data(host_keys); + std::vector expected(n); + testingAlgo.call_serial(source_host_keys_state.cbegin(), source_host_keys_state.cend(), expected.data()); + EXPECT_EQ_N(expected.cbegin(), host_keys.get(), n, testingAlgo.getMsg(true)); + } - std::vector expected(n); - testingAlgo.call_serial(source_host_keys_state.cbegin(), source_host_keys_state.cend(), expected.data()); - EXPECT_EQ_N(expected.cbegin(), host_keys.get(), n, testingAlgo.getMsg(true)); - } + // specialization for non-random_access iterators + template + ::std::enable_if_t> + operator()(Policy&& exec, Iterator1 keys_first, Iterator1 keys_last, Size n) + { } };