MCPcopy Create free account
hub / github.com/boostorg/compute / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

test/test_transform_if.cpp:23–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21namespace compute = boost::compute;
22
23BOOST_AUTO_TEST_CASE(transform_if_odd)
24{
25 using boost::compute::abs;
26 using boost::compute::lambda::_1;
27
28 int data[] = { -2, -3, -4, -5, -6, -7, -8, -9 };
29 compute::vector<int> input(data, data + 8, queue);
30 compute::vector<int> output(input.size(), context);
31
32 compute::vector<int>::iterator end = compute::transform_if(
33 input.begin(), input.end(), output.begin(), abs<int>(), _1 % 2 != 0, queue
34 );
35 BOOST_CHECK_EQUAL(std::distance(output.begin(), end), 4);
36
37 CHECK_RANGE_EQUAL(int, 4, output, (+3, +5, +7, +9));
38}
39
40BOOST_AUTO_TEST_SUITE_END()

Callers

nothing calls this directly

Calls 4

transform_ifFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected