| 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 TestFunctionalHash |
| 12 | #include <boost/test/unit_test.hpp> |
| 13 | |
| 14 | #include <boost/compute/system.hpp> |
| 15 | #include <boost/compute/algorithm/copy_n.hpp> |
| 16 | #include <boost/compute/algorithm/transform.hpp> |
| 17 | #include <boost/compute/container/vector.hpp> |
| 18 | #include <boost/compute/functional/hash.hpp> |
| 19 | |
| 20 | #include "check_macros.hpp" |
| 21 | #include "context_setup.hpp" |
| 22 | |
| 23 | namespace compute = boost::compute; |
| 24 | |
| 25 | BOOST_AUTO_TEST_CASE(hash_int) |
| 26 | { |
| 27 | using compute::ulong_; |
| 28 | |
| 29 | int data[] = { 1, 2, 3, 4 }; |
| 30 | compute::vector<int> input_values(data, data + 4, queue); |
| 31 | compute::vector<ulong_> hash_values(4, context); |
| 32 | |
| 33 | compute::transform( |
| 34 | input_values.begin(), |
| 35 | input_values.end(), |
| 36 | hash_values.begin(), |
| 37 | compute::hash<int>(), |
| 38 | queue |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | BOOST_AUTO_TEST_SUITE_END() |
| 43 | |