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

Function BOOST_AUTO_TEST_CASE

test/test_adjacent_difference.cpp:29–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace compute = boost::compute;
28
29BOOST_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
50BOOST_AUTO_TEST_CASE(all_same)
51{

Callers

nothing calls this directly

Calls 9

iotaFunction · 0.85
adjacent_differenceFunction · 0.85
copyFunction · 0.85
fillFunction · 0.85
copy_nFunction · 0.85
all_ofFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected