MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

compute/test/test_copy_if.cpp:24–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace compute = boost::compute;
23
24BOOST_AUTO_TEST_CASE(copy_if_int)
25{
26 int data[] = { 1, 6, 3, 5, 8, 2, 4 };
27 bc::vector<int> input(data, data + 7, queue);
28
29 bc::vector<int> output(input.size(), context);
30 bc::fill(output.begin(), output.end(), -1, queue);
31
32 using ::boost::compute::_1;
33
34 bc::vector<int>::iterator iter =
35 bc::copy_if(input.begin(), input.end(),
36 output.begin(), _1 < 5, queue);
37 BOOST_VERIFY(iter == output.begin() + 4);
38 CHECK_RANGE_EQUAL(int, 7, output, (1, 3, 2, 4, -1, -1, -1));
39
40 bc::fill(output.begin(), output.end(), 42, queue);
41 iter =
42 bc::copy_if(input.begin(), input.end(),
43 output.begin(), _1 * 2 >= 10, queue);
44 BOOST_VERIFY(iter == output.begin() + 3);
45 CHECK_RANGE_EQUAL(int, 7, output, (6, 5, 8, 42, 42, 42, 42));
46}
47
48BOOST_AUTO_TEST_CASE(copy_if_odd)
49{

Callers

nothing calls this directly

Calls 6

copy_ifFunction · 0.85
copy_index_ifFunction · 0.85
fillFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected