• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 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 TestTabulate
12 #include <boost/test/unit_test.hpp>
13 
14 #include <boost/compute/system.hpp>
15 #include <boost/compute/function.hpp>
16 #include <boost/compute/algorithm/copy_n.hpp>
17 #include <boost/compute/container/vector.hpp>
18 #include <boost/compute/experimental/tabulate.hpp>
19 
20 #include "check_macros.hpp"
21 #include "context_setup.hpp"
22 
23 namespace compute = boost::compute;
24 
BOOST_AUTO_TEST_CASE(tabulate_negative_int)25 BOOST_AUTO_TEST_CASE(tabulate_negative_int)
26 {
27     BOOST_COMPUTE_FUNCTION(int, negate, (int x),
28     {
29         return -x;
30     });
31 
32     compute::vector<int> vector(10, context);
33     compute::experimental::tabulate(vector.begin(), vector.end(), negate, queue);
34     CHECK_RANGE_EQUAL(int, 10, vector, (0, -1, -2, -3, -4, -5, -6, -7, -8, -9));
35 }
36 
37 BOOST_AUTO_TEST_SUITE_END()
38