1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
16 #include "test_macros.h"
18 template <class T
, int expected
>
22 static_assert(std::numeric_limits
<T
>::digits10
== expected
, "digits10 test 1");
23 static_assert(std::numeric_limits
<T
>::is_bounded
, "digits10 test 5");
24 static_assert(std::numeric_limits
<const T
>::digits10
== expected
, "digits10 test 2");
25 static_assert(std::numeric_limits
<const T
>::is_bounded
, "digits10 test 6");
26 static_assert(std::numeric_limits
<volatile T
>::digits10
== expected
, "digits10 test 3");
27 static_assert(std::numeric_limits
<volatile T
>::is_bounded
, "digits10 test 7");
28 static_assert(std::numeric_limits
<const volatile T
>::digits10
== expected
, "digits10 test 4");
29 static_assert(std::numeric_limits
<const volatile T
>::is_bounded
, "digits10 test 8");
36 test
<signed char, 2>();
37 test
<unsigned char, 2>();
38 test
<wchar_t, 5*sizeof(wchar_t)/2-1>(); // 4 -> 9 and 2 -> 4
39 #if TEST_STD_VER > 17 && defined(__cpp_char8_t)
45 test
<unsigned short, 4>();
47 test
<unsigned int, 9>();
48 test
<long, sizeof(long) == 4 ? 9 : 18>();
49 test
<unsigned long, sizeof(long) == 4 ? 9 : 19>();
50 test
<long long, 18>();
51 test
<unsigned long long, 19>();
52 #ifndef TEST_HAS_NO_INT128
53 test
<__int128_t
, 38>();
54 test
<__uint128_t
, 38>();
56 test
<float, FLT_DIG
>();
57 test
<double, DBL_DIG
>();
58 test
<long double, LDBL_DIG
>();