| 21 | namespace compute = boost::compute; |
| 22 | |
| 23 | BOOST_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 | |
| 40 | BOOST_AUTO_TEST_SUITE_END() |
nothing calls this directly
no test coverage detected