| 27 | namespace compute = boost::compute; |
| 28 | |
| 29 | BOOST_AUTO_TEST_CASE(adjacent_difference_int) |
| 30 | { |
| 31 | compute::vector<int> a(5, context); |
| 32 | compute::iota(a.begin(), a.end(), 0, queue); |
| 33 | CHECK_RANGE_EQUAL(int, 5, a, (0, 1, 2, 3, 4)); |
| 34 | |
| 35 | compute::vector<int> b(5, context); |
| 36 | compute::vector<int>::iterator iter = |
| 37 | compute::adjacent_difference(a.begin(), a.end(), b.begin(), queue); |
| 38 | BOOST_CHECK(iter == b.end()); |
| 39 | CHECK_RANGE_EQUAL(int, 5, b, (0, 1, 1, 1, 1)); |
| 40 | |
| 41 | int data[] = { 1, 9, 36, 48, 81 }; |
| 42 | compute::copy(data, data + 5, a.begin(), queue); |
| 43 | CHECK_RANGE_EQUAL(int, 5, a, (1, 9, 36, 48, 81)); |
| 44 | |
| 45 | iter = compute::adjacent_difference(a.begin(), a.end(), b.begin(), queue); |
| 46 | BOOST_CHECK(iter == b.end()); |
| 47 | CHECK_RANGE_EQUAL(int, 5, b, (1, 8, 27, 12, 33)); |
| 48 | } |
| 49 | |
| 50 | BOOST_AUTO_TEST_CASE(all_same) |
| 51 | { |