test_unique_copy.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #define BOOST_TEST_MODULE TestUniqueCopy
  11. #include <boost/test/unit_test.hpp>
  12. #include <boost/compute/algorithm/unique_copy.hpp>
  13. #include <boost/compute/container/vector.hpp>
  14. #include "check_macros.hpp"
  15. #include "context_setup.hpp"
  16. namespace bc = boost::compute;
  17. namespace compute = boost::compute;
  18. BOOST_AUTO_TEST_CASE(unique_copy_int)
  19. {
  20. int data[] = {1, 6, 6, 4, 2, 2, 4};
  21. bc::vector<int> input(data, data + 7, queue);
  22. bc::vector<int> result(5, context);
  23. bc::vector<int>::iterator iter =
  24. bc::unique_copy(input.begin(), input.end(), result.begin(), queue);
  25. BOOST_VERIFY(iter == result.begin() + 5);
  26. CHECK_RANGE_EQUAL(int, 5, result, (1, 6, 4, 2, 4));
  27. }
  28. BOOST_AUTO_TEST_SUITE_END()