]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/test/test_inplace_merge.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #define BOOST_TEST_MODULE TestInplaceMerge
12 #include <boost/test/unit_test.hpp>
14 #include <boost/compute/system.hpp>
15 #include <boost/compute/algorithm/inplace_merge.hpp>
16 #include <boost/compute/container/vector.hpp>
18 #include "check_macros.hpp"
19 #include "context_setup.hpp"
21 namespace compute
= boost::compute
;
23 BOOST_AUTO_TEST_CASE(simple_merge_int
)
25 int data
[] = { 1, 3, 5, 7, 2, 4, 6, 8 };
26 compute::vector
<int> vector(data
, data
+ 8, queue
);
28 // merge each half in-place
29 compute::inplace_merge(
35 CHECK_RANGE_EQUAL(int, 8, vector
, (1, 2, 3, 4, 5, 6, 7, 8));
37 // run again on already sorted list
38 compute::inplace_merge(
44 CHECK_RANGE_EQUAL(int, 8, vector
, (1, 2, 3, 4, 5, 6, 7, 8));
47 BOOST_AUTO_TEST_SUITE_END()