is_enum_test.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // (C) Copyright John Maddock 2000.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifdef TEST_STD
  6. # include <type_traits>
  7. #else
  8. # include <boost/type_traits/is_enum.hpp>
  9. #endif
  10. #include "test.hpp"
  11. #include "check_integral_constant.hpp"
  12. #ifndef BOOST_NO_CXX11_SCOPED_ENUMS
  13. enum class test_enum
  14. {
  15. a, b
  16. };
  17. #endif
  18. TT_TEST_BEGIN(is_enum)
  19. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<int>::value, false);
  20. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<enum_UDT>::value, true);
  21. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<int_convertible>::value, false);
  22. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<int&>::value, false);
  23. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  24. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<int&&>::value, false);
  25. #endif
  26. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<boost::noncopyable>::value, false);
  27. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<void>::value, false);
  28. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<test_abc1>::value, false);
  29. #ifndef BOOST_NO_CXX11_SCOPED_ENUMS
  30. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<test_enum>::value, true);
  31. #endif
  32. TT_TEST_END