1 // { dg-do run { target c++11 } }
2 // { dg-require-cstdint "" }
3 
4 // 2008-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
5 //
6 // Copyright (C) 2008-2021 Free Software Foundation, Inc.
7 //
8 // This file is part of the GNU ISO C++ Library.  This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
12 // any later version.
13 
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3.  If not see
21 // <http://www.gnu.org/licenses/>.
22 
23 // 18.2.1.1 template class numeric_limits
24 
25 #include <limits>
26 #include <cstdint>
27 #include <testsuite_hooks.h>
28 
29 // Test specializations for char16_t and char32_t, in C++11.
30 template<typename T, typename R>
31   void
do_test()32   do_test()
33   {
34     typedef std::numeric_limits<T> char_type;
35     typedef std::numeric_limits<R> impl_type;
36 
37     VERIFY( char_type::is_specialized == impl_type::is_specialized );
38     VERIFY( char_type::min() == impl_type::min() );
39     VERIFY( char_type::max() == impl_type::max() );
40     VERIFY( char_type::digits == impl_type::digits );
41     VERIFY( char_type::digits10 == impl_type::digits10 );
42     VERIFY( char_type::is_signed == impl_type::is_signed );
43     VERIFY( char_type::is_integer == impl_type::is_integer );
44     VERIFY( char_type::is_exact == impl_type::is_exact );
45     VERIFY( char_type::radix == impl_type::radix );
46     VERIFY( char_type::epsilon() == impl_type::epsilon() );
47     VERIFY( char_type::round_error() == impl_type::round_error() );
48     VERIFY( char_type::min_exponent == impl_type::min_exponent );
49     VERIFY( char_type::min_exponent10 == impl_type::min_exponent10 );
50     VERIFY( char_type::max_exponent == impl_type::max_exponent );
51     VERIFY( char_type::max_exponent10 == impl_type::max_exponent10 );
52     VERIFY( char_type::has_infinity == impl_type::has_infinity );
53     VERIFY( char_type::has_quiet_NaN == impl_type::has_quiet_NaN );
54     VERIFY( char_type::has_signaling_NaN == impl_type::has_signaling_NaN );
55     VERIFY( char_type::has_denorm == impl_type::has_denorm );
56     VERIFY( char_type::has_denorm_loss == impl_type::has_denorm_loss );
57     VERIFY( char_type::infinity() == impl_type::infinity() );
58     VERIFY( char_type::quiet_NaN() == impl_type::quiet_NaN() );
59     VERIFY( char_type::signaling_NaN() == impl_type::signaling_NaN() );
60     VERIFY( char_type::denorm_min() == impl_type::denorm_min() );
61     VERIFY( char_type::is_iec559 == impl_type::is_iec559 );
62     VERIFY( char_type::is_bounded == impl_type::is_bounded );
63     VERIFY( char_type::is_modulo == impl_type::is_modulo );
64     VERIFY( char_type::traps == impl_type::traps );
65     VERIFY( char_type::tinyness_before == impl_type::tinyness_before );
66     VERIFY( char_type::round_style == impl_type::round_style );
67   }
68 
main()69 int main()
70 {
71   do_test<char16_t, std::uint_least16_t>();
72   do_test<char32_t, std::uint_least32_t>();
73 
74   return 0;
75 }
76