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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [18_support/] [numeric_limits/] [specialization.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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