MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / test_remove_copy

Function test_remove_copy

tests/pstl/remove_copy.cpp:26–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25template<class T, class Policy, class Generator>
26void test_remove_copy(Policy&& pol, Generator&& gen, std::size_t problem_size,
27 const T &value) {
28 std::vector<T> data(problem_size);
29 for(int i = 0; i < problem_size; ++i) {
30 data[i] = gen(i);
31 }
32
33 std::vector<int> dest_device(problem_size);
34 std::vector<int> dest_host(problem_size);
35
36 auto ret = std::remove_copy(pol, data.begin(),
37 data.end(), dest_device.begin(), value);
38 auto ret_reference = std::remove_copy(data.begin(), data.end(),
39 dest_host.begin(), value);
40
41 BOOST_CHECK(std::distance(dest_device.begin(), ret) ==
42 std::distance(dest_host.begin(), ret_reference));
43
44 BOOST_CHECK(dest_device == dest_host);
45
46}
47
48using types = boost::mp11::mp_list<int>;
49BOOST_AUTO_TEST_CASE_TEMPLATE(par_unseq_empty, T, types) {

Callers

nothing calls this directly

Calls 3

remove_copyFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected