OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [18_support/] [numeric_limits/] [specialization_default_values.cc] - Blame information for rev 424

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// { dg-add-options ieee }
2
 
3
// 1999-08-23 bkoz
4
 
5
// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2009
6
// Free Software Foundation
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 <limits.h>
27
#include <float.h>
28
#include <cwchar>
29
#include <testsuite_hooks.h>
30
 
31
template<typename T>
32
  struct A
33
  {
34
    int key;
35
  public:
36
    A(int i = 0): key(i) { }
37
    bool
38
    operator==(int i) { return i == key; }
39
  };
40
 
41
struct B
42
{
43
  B(int = 0) { }
44
};
45
 
46
 
47
bool test01()
48
{
49
  bool test __attribute__((unused)) = true;
50
  std::numeric_limits< A<B> > obj;
51
 
52
  VERIFY( !obj.is_specialized );
53
  VERIFY( obj.min() == 0 );
54
  VERIFY( obj.max() == 0 );
55
  VERIFY( obj.digits ==  0 );
56
  VERIFY( obj.digits10 == 0 );
57
  VERIFY( !obj.is_signed );
58
  VERIFY( !obj.is_integer );
59
  VERIFY( !obj.is_exact );
60
  VERIFY( obj.radix == 0 );
61
  VERIFY( obj.epsilon() == 0 );
62
  VERIFY( obj.round_error() == 0 );
63
  VERIFY( obj.min_exponent == 0 );
64
  VERIFY( obj.min_exponent10 == 0 );
65
  VERIFY( obj.max_exponent == 0 );
66
  VERIFY( obj.max_exponent10 == 0 );
67
  VERIFY( !obj.has_infinity );
68
  VERIFY( !obj.has_quiet_NaN );
69
  VERIFY( !obj.has_signaling_NaN );
70
  VERIFY( !obj.has_denorm );
71
  VERIFY( !obj.has_denorm_loss );
72
  VERIFY( obj.infinity() == 0 );
73
  VERIFY( obj.quiet_NaN() == 0 );
74
  VERIFY( obj.signaling_NaN() == 0 );
75
  VERIFY( obj.denorm_min() == 0 );
76
  VERIFY( !obj.is_iec559 );
77
  VERIFY( !obj.is_bounded );
78
  VERIFY( !obj.is_modulo );
79
  VERIFY( !obj.traps );
80
  VERIFY( !obj.tinyness_before );
81
  VERIFY( obj.round_style == std::round_toward_zero );
82
  return test;
83
}
84
 
85
// test linkage of the generic bits
86
template struct std::numeric_limits<B>;
87
 
88
void test02()
89
{
90
  typedef std::numeric_limits<B> b_nl_type;
91
 
92
  // Should probably do all of them...
93
  const int* __attribute__((unused)) pi1 = &b_nl_type::digits;
94
  const int* __attribute__((unused)) pi2 = &b_nl_type::digits10;
95
  const int* __attribute__((unused)) pi3 = &b_nl_type::max_exponent10;
96
  const bool* __attribute__((unused)) pb1 = &b_nl_type::traps;
97
}
98
 
99
 
100
int main()
101
{
102
  test01();
103
  test02();
104
 
105
  return 0;
106
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.