1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_TEST_CHECK_MACROS_HPP
12 #define BOOST_COMPUTE_TEST_CHECK_MACROS_HPP
14 #define LIST_ARRAY_VALUES(z, n, data) \
15 BOOST_PP_COMMA_IF(n) BOOST_PP_ARRAY_ELEM(n, data)
17 // checks 'size' values of 'type' in the device range 'actual`
18 // against the values given in the array 'expected'
19 #define CHECK_RANGE_EQUAL(type, size, actual, expected) \
22 boost::compute::copy( \
23 actual.begin(), actual.begin()+size, _actual, queue \
25 const type _expected[size] = { \
26 BOOST_PP_REPEAT(size, LIST_ARRAY_VALUES, (size, expected)) \
28 BOOST_CHECK_EQUAL_COLLECTIONS( \
29 _actual, _actual + size, _expected, _expected + size \
33 #define CHECK_HOST_RANGE_EQUAL(type, size, actual, expected) \
35 const type _expected[size] = { \
36 BOOST_PP_REPEAT(size, LIST_ARRAY_VALUES, (size, expected)) \
38 BOOST_CHECK_EQUAL_COLLECTIONS( \
39 actual, actual + size, _expected, _expected + size \
43 #define CHECK_STRING_EQUAL(actual, expected) \
45 std::string _actual(actual.size(), '\0'); \
46 boost::compute::copy( \
47 actual.begin(), actual.end(), _actual.begin(), queue \
49 BOOST_CHECK_EQUAL(_actual, expected); \
52 #endif // BOOST_COMPUTE_TEST_CHECK_MACROS_HPP