]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/test/test_for_each.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 TestForEach
12 #include <boost/test/unit_test.hpp>
14 #include <boost/compute/function.hpp>
15 #include <boost/compute/algorithm/iota.hpp>
16 #include <boost/compute/algorithm/for_each.hpp>
17 #include <boost/compute/algorithm/for_each_n.hpp>
18 #include <boost/compute/container/vector.hpp>
20 #include "context_setup.hpp"
22 namespace bc
= boost::compute
;
24 BOOST_AUTO_TEST_CASE(for_each_nop
)
26 bc::vector
<int> vector(4, context
);
27 bc::iota(vector
.begin(), vector
.end(), 0, queue
);
29 BOOST_COMPUTE_FUNCTION(void, nop
, (int ignored
), {});
31 bc::for_each(vector
.begin(), vector
.end(), nop
, queue
);
35 BOOST_AUTO_TEST_CASE(for_each_n_nop
)
37 bc::vector
<int> vector(4, context
);
38 bc::iota(vector
.begin(), vector
.end(), 0, queue
);
40 BOOST_COMPUTE_FUNCTION(void, nop
, (int ignored
), {});
42 bc::for_each_n(vector
.begin(), vector
.size(), nop
, queue
);
46 BOOST_AUTO_TEST_SUITE_END()