• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TestOpenCLError
12 #include <boost/test/unit_test.hpp>
13 
14 #include <boost/compute/exception/opencl_error.hpp>
15 
16 #include "check_macros.hpp"
17 #include "context_setup.hpp"
18 
BOOST_AUTO_TEST_CASE(error_to_string)19 BOOST_AUTO_TEST_CASE(error_to_string)
20 {
21     using boost::compute::opencl_error;
22 
23     BOOST_CHECK_EQUAL(opencl_error::to_string(CL_SUCCESS), "Success");
24     BOOST_CHECK_EQUAL(opencl_error::to_string(CL_INVALID_VALUE), "Invalid Value");
25     BOOST_CHECK_EQUAL(opencl_error::to_string(-123456), "Unknown OpenCL Error (-123456)");
26 }
27 
BOOST_AUTO_TEST_CASE(error_code)28 BOOST_AUTO_TEST_CASE(error_code)
29 {
30     boost::compute::opencl_error e(CL_INVALID_DEVICE);
31     BOOST_CHECK_EQUAL(e.error_code(), CL_INVALID_DEVICE);
32     BOOST_CHECK_EQUAL(e.error_string(), "Invalid Device");
33 }
34 
35 BOOST_AUTO_TEST_SUITE_END()
36