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 // max_exponent10
13 
14 #include <limits>
15 #include <cfloat>
16 
17 template <class T, int expected>
18 void
test()19 test()
20 {
21     static_assert(std::numeric_limits<T>::max_exponent10 == expected, "max_exponent10 test 1");
22     static_assert(std::numeric_limits<const T>::max_exponent10 == expected, "max_exponent10 test 2");
23     static_assert(std::numeric_limits<volatile T>::max_exponent10 == expected, "max_exponent10 test 3");
24     static_assert(std::numeric_limits<const volatile T>::max_exponent10 == expected, "max_exponent10 test 4");
25 }
26 
main()27 int main()
28 {
29     test<bool, 0>();
30     test<char, 0>();
31     test<signed char, 0>();
32     test<unsigned char, 0>();
33     test<wchar_t, 0>();
34 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
35     test<char16_t, 0>();
36     test<char32_t, 0>();
37 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
38     test<short, 0>();
39     test<unsigned short, 0>();
40     test<int, 0>();
41     test<unsigned int, 0>();
42     test<long, 0>();
43     test<unsigned long, 0>();
44     test<long long, 0>();
45     test<unsigned long long, 0>();
46 #ifndef _LIBCPP_HAS_NO_INT128
47     test<__int128_t, 0>();
48     test<__uint128_t, 0>();
49 #endif
50     test<float, FLT_MAX_10_EXP>();
51     test<double, DBL_MAX_10_EXP>();
52     test<long double, LDBL_MAX_10_EXP>();
53 }
54