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

Function BOOST_AUTO_TEST_CASE

test/test_reduce.cpp:29–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace compute = boost::compute;
28
29BOOST_AUTO_TEST_CASE(reduce_int)
30{
31 int data[] = { 1, 5, 9, 13, 17 };
32 compute::vector<int> vector(data, data + 5, queue);
33 int sum;
34 compute::reduce(vector.begin(), vector.end(), &sum, compute::plus<int>(), queue);
35 BOOST_CHECK_EQUAL(sum, 45);
36
37 int product;
38 compute::reduce(vector.begin(), vector.end(), &product, compute::multiplies<int>(), queue);
39 BOOST_CHECK_EQUAL(product, 9945);
40}
41
42BOOST_AUTO_TEST_CASE(reduce_empty_vector)
43{

Callers

nothing calls this directly

Calls 10

reduceFunction · 0.85
fillFunction · 0.85
make_constant_iteratorFunction · 0.85
make_counting_iteratorFunction · 0.85
make_transform_iteratorFunction · 0.85
copyFunction · 0.85
push_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected