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 // radix
12
13 #include <limits>
14 #include <cfloat>
15
16 #include "test_macros.h"
17
18 template <class T, int expected>
19 void
test()20 test()
21 {
22 static_assert(std::numeric_limits<T>::radix == expected, "radix test 1");
23 static_assert(std::numeric_limits<const T>::radix == expected, "radix test 2");
24 static_assert(std::numeric_limits<volatile T>::radix == expected, "radix test 3");
25 static_assert(std::numeric_limits<const volatile T>::radix == expected, "radix test 4");
26 }
27
main(int,char **)28 int main(int, char**)
29 {
30 test<bool, 2>();
31 test<char, 2>();
32 test<signed char, 2>();
33 test<unsigned char, 2>();
34 test<wchar_t, 2>();
35 #if TEST_STD_VER > 17 && defined(__cpp_char8_t)
36 test<char8_t, 2>();
37 #endif
38 test<char16_t, 2>();
39 test<char32_t, 2>();
40 test<short, 2>();
41 test<unsigned short, 2>();
42 test<int, 2>();
43 test<unsigned int, 2>();
44 test<long, 2>();
45 test<unsigned long, 2>();
46 test<long long, 2>();
47 test<unsigned long long, 2>();
48 #ifndef TEST_HAS_NO_INT128
49 test<__int128_t, 2>();
50 test<__uint128_t, 2>();
51 #endif
52 test<float, FLT_RADIX>();
53 test<double, FLT_RADIX>();
54 test<long double, FLT_RADIX>();
55
56 return 0;
57 }
58