• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2014 Roshan <thisisroshansmail@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 TestUniqueCopy
12 #include <boost/test/unit_test.hpp>
13 
14 #include <boost/compute/algorithm/unique_copy.hpp>
15 #include <boost/compute/container/vector.hpp>
16 
17 #include "check_macros.hpp"
18 #include "context_setup.hpp"
19 
20 namespace bc = boost::compute;
21 namespace compute = boost::compute;
22 
BOOST_AUTO_TEST_CASE(unique_copy_int)23 BOOST_AUTO_TEST_CASE(unique_copy_int)
24 {
25     int data[] = {1, 6, 6, 4, 2, 2, 4};
26 
27     bc::vector<int> input(data, data + 7, queue);
28     bc::vector<int> result(5, context);
29 
30     bc::vector<int>::iterator iter =
31         bc::unique_copy(input.begin(), input.end(), result.begin(), queue);
32 
33     BOOST_VERIFY(iter == result.begin() + 5);
34     CHECK_RANGE_EQUAL(int, 5, result, (1, 6, 4, 2, 4));
35 }
36 
37 BOOST_AUTO_TEST_SUITE_END()
38