1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // test numeric_limits
10 
11 // is_integer
12 
13 #include <limits>
14 
15 #include "test_macros.h"
16 
17 template <class T, bool expected>
18 void
test()19 test()
20 {
21     static_assert(std::numeric_limits<T>::is_integer == expected, "is_integer test 1");
22     static_assert(std::numeric_limits<const T>::is_integer == expected, "is_integer test 2");
23     static_assert(std::numeric_limits<volatile T>::is_integer == expected, "is_integer test 3");
24     static_assert(std::numeric_limits<const volatile T>::is_integer == expected, "is_integer test 4");
25 }
26 
main(int,char **)27 int main(int, char**)
28 {
29     test<bool, true>();
30     test<char, true>();
31     test<signed char, true>();
32     test<unsigned char, true>();
33     test<wchar_t, true>();
34 #if TEST_STD_VER > 17 && defined(__cpp_char8_t)
35     test<char8_t, true>();
36 #endif
37 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
38     test<char16_t, true>();
39     test<char32_t, true>();
40 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
41     test<short, true>();
42     test<unsigned short, true>();
43     test<int, true>();
44     test<unsigned int, true>();
45     test<long, true>();
46     test<unsigned long, true>();
47     test<long long, true>();
48     test<unsigned long long, true>();
49 #ifndef _LIBCPP_HAS_NO_INT128
50     test<__int128_t, true>();
51     test<__uint128_t, true>();
52 #endif
53     test<float, false>();
54     test<double, false>();
55     test<long double, false>();
56 
57   return 0;
58 }
59