is_integer.pass.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // test numeric_limits
  10. // is_integer
  11. #include <limits>
  12. template <class T, bool expected>
  13. void
  14. test()
  15. {
  16. static_assert(std::numeric_limits<T>::is_integer == expected, "is_integer test 1");
  17. static_assert(std::numeric_limits<const T>::is_integer == expected, "is_integer test 2");
  18. static_assert(std::numeric_limits<volatile T>::is_integer == expected, "is_integer test 3");
  19. static_assert(std::numeric_limits<const volatile T>::is_integer == expected, "is_integer test 4");
  20. }
  21. int main()
  22. {
  23. test<bool, true>();
  24. test<char, true>();
  25. test<signed char, true>();
  26. test<unsigned char, true>();
  27. test<wchar_t, true>();
  28. #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
  29. test<char16_t, true>();
  30. test<char32_t, true>();
  31. #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
  32. test<short, true>();
  33. test<unsigned short, true>();
  34. test<int, true>();
  35. test<unsigned int, true>();
  36. test<long, true>();
  37. test<unsigned long, true>();
  38. test<long long, true>();
  39. test<unsigned long long, true>();
  40. test<float, false>();
  41. test<double, false>();
  42. test<long double, false>();
  43. }