test_result_of.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #define BOOST_TEST_MODULE TestResultOf
  11. #include <boost/test/unit_test.hpp>
  12. #include <boost/compute/function.hpp>
  13. #include <boost/compute/functional/operator.hpp>
  14. #include <boost/compute/type_traits/result_of.hpp>
  15. BOOST_AUTO_TEST_CASE(result_of_function)
  16. {
  17. using boost::compute::function;
  18. using boost::compute::result_of;
  19. BOOST_STATIC_ASSERT((
  20. boost::is_same<result_of<function<int()>()>::type, int>::value
  21. ));
  22. }
  23. BOOST_AUTO_TEST_CASE(result_of_operators)
  24. {
  25. using boost::compute::plus;
  26. using boost::compute::minus;
  27. using boost::compute::result_of;
  28. BOOST_STATIC_ASSERT((
  29. boost::is_same<result_of<plus<int>(int, int)>::type, int>::value
  30. ));
  31. BOOST_STATIC_ASSERT((
  32. boost::is_same<result_of<minus<int>(int, int)>::type, int>::value
  33. ));
  34. }