MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

compute/test/test_stable_sort.cpp:25–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace compute = boost::compute;
24
25BOOST_AUTO_TEST_CASE(sort_int_vector)
26{
27 int data[] = { -4, 152, -5000, 963, 75321, -456, 0, 1112 };
28 compute::vector<int> vector(data, data + 8, queue);
29 BOOST_CHECK_EQUAL(vector.size(), size_t(8));
30 BOOST_CHECK(compute::is_sorted(vector.begin(), vector.end(), queue) == false);
31
32 compute::stable_sort(vector.begin(), vector.end(), queue);
33 BOOST_CHECK(compute::is_sorted(vector.begin(), vector.end(), queue) == true);
34 CHECK_RANGE_EQUAL(int, 8, vector, (-5000, -456, -4, 0, 152, 963, 1112, 75321));
35
36 // sort reversed
37 compute::stable_sort(vector.begin(), vector.end(), compute::greater<int>(), queue);
38 CHECK_RANGE_EQUAL(int, 8, vector, (75321, 1112, 963, 152, 0, -4, -456, -5000));
39}
40
41BOOST_AUTO_TEST_CASE(sort_int2)
42{

Callers

nothing calls this directly

Calls 5

is_sortedFunction · 0.85
stable_sortFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected