2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / libstdc++-v3 / testsuite / 18_support / numeric_limits / char16_32_t.cc
blobc2957506cb0bdbbe8d8e337c833b4f552d0f84c0
1 // { dg-options "-std=gnu++0x" }
2 // 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
3 //
4 // Copyright (C) 2008 Free Software Foundation
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 // USA.
22 // 18.2.1.1 template class numeric_limits
24 #include <limits>
25 #include <cstdint>
26 #include <testsuite_hooks.h>
28 // Test specializations for char16_t and char32_t, in C++0x.
29 template<typename T, typename R>
30 void
31 do_test()
33 bool test __attribute__((unused)) = true;
35 typedef std::numeric_limits<T> char_type;
36 typedef std::numeric_limits<R> impl_type;
38 VERIFY( char_type::is_specialized == impl_type::is_specialized );
39 VERIFY( char_type::min() == impl_type::min() );
40 VERIFY( char_type::max() == impl_type::max() );
41 VERIFY( char_type::digits == impl_type::digits );
42 VERIFY( char_type::digits10 == impl_type::digits10 );
43 VERIFY( char_type::is_signed == impl_type::is_signed );
44 VERIFY( char_type::is_integer == impl_type::is_integer );
45 VERIFY( char_type::is_exact == impl_type::is_exact );
46 VERIFY( char_type::radix == impl_type::radix );
47 VERIFY( char_type::epsilon() == impl_type::epsilon() );
48 VERIFY( char_type::round_error() == impl_type::round_error() );
49 VERIFY( char_type::min_exponent == impl_type::min_exponent );
50 VERIFY( char_type::min_exponent10 == impl_type::min_exponent10 );
51 VERIFY( char_type::max_exponent == impl_type::max_exponent );
52 VERIFY( char_type::max_exponent10 == impl_type::max_exponent10 );
53 VERIFY( char_type::has_infinity == impl_type::has_infinity );
54 VERIFY( char_type::has_quiet_NaN == impl_type::has_quiet_NaN );
55 VERIFY( char_type::has_signaling_NaN == impl_type::has_signaling_NaN );
56 VERIFY( char_type::has_denorm == impl_type::has_denorm );
57 VERIFY( char_type::has_denorm_loss == impl_type::has_denorm_loss );
58 VERIFY( char_type::infinity() == impl_type::infinity() );
59 VERIFY( char_type::quiet_NaN() == impl_type::quiet_NaN() );
60 VERIFY( char_type::signaling_NaN() == impl_type::signaling_NaN() );
61 VERIFY( char_type::denorm_min() == impl_type::denorm_min() );
62 VERIFY( char_type::is_iec559 == impl_type::is_iec559 );
63 VERIFY( char_type::is_bounded == impl_type::is_bounded );
64 VERIFY( char_type::is_modulo == impl_type::is_modulo );
65 VERIFY( char_type::traps == impl_type::traps );
66 VERIFY( char_type::tinyness_before == impl_type::tinyness_before );
67 VERIFY( char_type::round_style == impl_type::round_style );
70 int main()
72 #if _GLIBCXX_USE_C99_STDINT_TR1
73 do_test<char16_t, uint_least16_t>();
74 do_test<char32_t, uint_least32_t>();
75 #endif
76 return 0;