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