1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
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
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #define BOOST_TEST_MODULE TestFunctionalIdentity
12 #include <boost/test/unit_test.hpp>
13
14 #include <boost/compute/system.hpp>
15 #include <boost/compute/algorithm/transform.hpp>
16 #include <boost/compute/container/vector.hpp>
17 #include <boost/compute/functional/identity.hpp>
18
19 #include "check_macros.hpp"
20 #include "context_setup.hpp"
21
22 namespace compute = boost::compute;
23
BOOST_AUTO_TEST_CASE(copy_with_identity_transform)24 BOOST_AUTO_TEST_CASE(copy_with_identity_transform)
25 {
26 int data[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
27 compute::vector<int> input(data, data + 8, queue);
28 compute::vector<int> output(8, context);
29
30 compute::transform(
31 input.begin(), input.end(), output.begin(), compute::identity<int>(), queue
32 );
33
34 CHECK_RANGE_EQUAL(
35 int, 8, output, (1, 2, 3, 4, 5, 6, 7, 8)
36 );
37 }
38
39 BOOST_AUTO_TEST_SUITE_END()
40