Home | History | Annotate | Download | only in numeric.limits.members
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // test numeric_limits
     11 
     12 // is_integer
     13 
     14 #include <limits>
     15 
     16 template <class T, bool expected>
     17 void
     18 test()
     19 {
     20     static_assert(std::numeric_limits<T>::is_integer == expected, "is_integer test 1");
     21     static_assert(std::numeric_limits<const T>::is_integer == expected, "is_integer test 2");
     22     static_assert(std::numeric_limits<volatile T>::is_integer == expected, "is_integer test 3");
     23     static_assert(std::numeric_limits<const volatile T>::is_integer == expected, "is_integer test 4");
     24 }
     25 
     26 int main()
     27 {
     28     test<bool, true>();
     29     test<char, true>();
     30     test<signed char, true>();
     31     test<unsigned char, true>();
     32     test<wchar_t, true>();
     33 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
     34     test<char16_t, true>();
     35     test<char32_t, true>();
     36 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
     37     test<short, true>();
     38     test<unsigned short, true>();
     39     test<int, true>();
     40     test<unsigned int, true>();
     41     test<long, true>();
     42     test<unsigned long, true>();
     43     test<long long, true>();
     44     test<unsigned long long, true>();
     45 #ifndef _LIBCPP_HAS_NO_INT128
     46     test<__int128_t, true>();
     47     test<__uint128_t, true>();
     48 #endif
     49     test<float, false>();
     50     test<double, false>();
     51     test<long double, false>();
     52 }
     53