summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/18_support/numeric_limits/char16_32_t.cc
blob: 62628c862276b9a36649acdc1f448629c5789006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// { dg-options "-std=gnu++0x" }
// { dg-require-cstdint "" }

// 2008-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
//
// Copyright (C) 2008, 2009 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

// 18.2.1.1 template class numeric_limits

#include <limits>
#include <cstdint>
#include <testsuite_hooks.h>

// Test specializations for char16_t and char32_t, in C++0x.
template<typename T, typename R>
  void
  do_test()
  {
    bool test __attribute__((unused)) = true;

    typedef std::numeric_limits<T> char_type;
    typedef std::numeric_limits<R> impl_type;

    VERIFY( char_type::is_specialized == impl_type::is_specialized );
    VERIFY( char_type::min() == impl_type::min() );
    VERIFY( char_type::max() == impl_type::max() );
    VERIFY( char_type::digits == impl_type::digits );
    VERIFY( char_type::digits10 == impl_type::digits10 );
    VERIFY( char_type::is_signed == impl_type::is_signed );
    VERIFY( char_type::is_integer == impl_type::is_integer );
    VERIFY( char_type::is_exact == impl_type::is_exact );
    VERIFY( char_type::radix == impl_type::radix );
    VERIFY( char_type::epsilon() == impl_type::epsilon() );
    VERIFY( char_type::round_error() == impl_type::round_error() );
    VERIFY( char_type::min_exponent == impl_type::min_exponent );
    VERIFY( char_type::min_exponent10 == impl_type::min_exponent10 );
    VERIFY( char_type::max_exponent == impl_type::max_exponent );
    VERIFY( char_type::max_exponent10 == impl_type::max_exponent10 );
    VERIFY( char_type::has_infinity == impl_type::has_infinity );
    VERIFY( char_type::has_quiet_NaN == impl_type::has_quiet_NaN );
    VERIFY( char_type::has_signaling_NaN == impl_type::has_signaling_NaN );
    VERIFY( char_type::has_denorm == impl_type::has_denorm );
    VERIFY( char_type::has_denorm_loss == impl_type::has_denorm_loss );
    VERIFY( char_type::infinity() == impl_type::infinity() );
    VERIFY( char_type::quiet_NaN() == impl_type::quiet_NaN() );
    VERIFY( char_type::signaling_NaN() == impl_type::signaling_NaN() );
    VERIFY( char_type::denorm_min() == impl_type::denorm_min() );
    VERIFY( char_type::is_iec559 == impl_type::is_iec559 );
    VERIFY( char_type::is_bounded == impl_type::is_bounded );
    VERIFY( char_type::is_modulo == impl_type::is_modulo );
    VERIFY( char_type::traps == impl_type::traps );
    VERIFY( char_type::tinyness_before == impl_type::tinyness_before );
    VERIFY( char_type::round_style == impl_type::round_style );
  }

int main()
{
  do_test<char16_t, uint_least16_t>();
  do_test<char32_t, uint_least32_t>();

  return 0;
}