]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/18_support/numeric_limits/char16_32_t.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 18_support / numeric_limits / char16_32_t.cc
CommitLineData
5fb0445d 1// { dg-options "-std=gnu++0x" }
f2752f1d
PC
2// { dg-require-cstdint "" }
3
5fb0445d
PC
4// 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
5//
aa118a03 6// Copyright (C) 2008-2014 Free Software Foundation, Inc.
5fb0445d
PC
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
748086b7 11// Free Software Foundation; either version 3, or (at your option)
5fb0445d
PC
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
748086b7
JJ
20// with this library; see the file COPYING3. If not see
21// <http://www.gnu.org/licenses/>.
5fb0445d
PC
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++0x.
30template<typename T, typename R>
31 void
32 do_test()
33 {
34 bool test __attribute__((unused)) = true;
35
36 typedef std::numeric_limits<T> char_type;
37 typedef std::numeric_limits<R> impl_type;
38
39 VERIFY( char_type::is_specialized == impl_type::is_specialized );
40 VERIFY( char_type::min() == impl_type::min() );
41 VERIFY( char_type::max() == impl_type::max() );
42 VERIFY( char_type::digits == impl_type::digits );
43 VERIFY( char_type::digits10 == impl_type::digits10 );
44 VERIFY( char_type::is_signed == impl_type::is_signed );
45 VERIFY( char_type::is_integer == impl_type::is_integer );
46 VERIFY( char_type::is_exact == impl_type::is_exact );
47 VERIFY( char_type::radix == impl_type::radix );
48 VERIFY( char_type::epsilon() == impl_type::epsilon() );
49 VERIFY( char_type::round_error() == impl_type::round_error() );
50 VERIFY( char_type::min_exponent == impl_type::min_exponent );
51 VERIFY( char_type::min_exponent10 == impl_type::min_exponent10 );
52 VERIFY( char_type::max_exponent == impl_type::max_exponent );
53 VERIFY( char_type::max_exponent10 == impl_type::max_exponent10 );
54 VERIFY( char_type::has_infinity == impl_type::has_infinity );
55 VERIFY( char_type::has_quiet_NaN == impl_type::has_quiet_NaN );
56 VERIFY( char_type::has_signaling_NaN == impl_type::has_signaling_NaN );
57 VERIFY( char_type::has_denorm == impl_type::has_denorm );
58 VERIFY( char_type::has_denorm_loss == impl_type::has_denorm_loss );
59 VERIFY( char_type::infinity() == impl_type::infinity() );
60 VERIFY( char_type::quiet_NaN() == impl_type::quiet_NaN() );
61 VERIFY( char_type::signaling_NaN() == impl_type::signaling_NaN() );
62 VERIFY( char_type::denorm_min() == impl_type::denorm_min() );
63 VERIFY( char_type::is_iec559 == impl_type::is_iec559 );
64 VERIFY( char_type::is_bounded == impl_type::is_bounded );
65 VERIFY( char_type::is_modulo == impl_type::is_modulo );
66 VERIFY( char_type::traps == impl_type::traps );
67 VERIFY( char_type::tinyness_before == impl_type::tinyness_before );
68 VERIFY( char_type::round_style == impl_type::round_style );
69 }
70
71int main()
72{
5fb0445d
PC
73 do_test<char16_t, uint_least16_t>();
74 do_test<char32_t, uint_least32_t>();
f2752f1d 75
5fb0445d
PC
76 return 0;
77}