test_no_device_found.cpp 924 B

12345678910111213141516171819202122232425262728293031
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2013-2015 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. #define BOOST_TEST_MODULE TestNoDeviceFound
  11. #include <boost/test/unit_test.hpp>
  12. #include <boost/compute/exception/no_device_found.hpp>
  13. void throw_no_device_found()
  14. {
  15. throw boost::compute::no_device_found();
  16. }
  17. BOOST_AUTO_TEST_CASE(what)
  18. {
  19. try {
  20. throw_no_device_found();
  21. BOOST_REQUIRE(false); // should not get here
  22. }
  23. catch(boost::compute::no_device_found& e){
  24. BOOST_CHECK_EQUAL(std::string(e.what()), "No OpenCL device found");
  25. }
  26. }