]>
Commit | Line | Data |
---|---|---|
b2dad0e3 BK |
1 | // 1999-08-23 bkoz |
2 | ||
3 | // Copyright (C) 1999 Free Software Foundation | |
4 | // | |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 2, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING. If not, write to the Free | |
18 | // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
19 | // USA. | |
20 | ||
21 | // 18.2.1.1 template class numeric_limits | |
22 | ||
23 | #include <limits> | |
aa1b2f7d | 24 | #include <debug_assert.h> |
b2dad0e3 BK |
25 | |
26 | ||
27 | template<typename T> | |
28 | struct A | |
29 | { | |
30 | int key; | |
31 | public: | |
32 | A(int i = 0): key(i) { } | |
33 | bool | |
34 | operator==(int i) { return i == key; } | |
35 | }; | |
36 | ||
37 | struct B { }; | |
38 | ||
39 | ||
40 | bool test01() | |
41 | { | |
42 | bool test = true; | |
43 | std::numeric_limits< A<B> > obj; | |
44 | ||
aa1b2f7d BV |
45 | VERIFY( !obj.is_specialized ); |
46 | VERIFY( obj.min() == 0 ); | |
47 | VERIFY( obj.max() == 0 ); | |
48 | VERIFY( obj.digits == 0 ); | |
49 | VERIFY( obj.digits10 == 0 ); | |
50 | VERIFY( !obj.is_signed ); | |
51 | VERIFY( !obj.is_integer ); | |
52 | VERIFY( !obj.is_exact ); | |
53 | VERIFY( obj.radix == 0 ); | |
54 | VERIFY( obj.epsilon() == 0 ); | |
55 | VERIFY( obj.round_error() == 0 ); | |
56 | VERIFY( obj.min_exponent == 0 ); | |
57 | VERIFY( obj.min_exponent10 == 0 ); | |
58 | VERIFY( obj.max_exponent == 0 ); | |
59 | VERIFY( obj.max_exponent10 == 0 ); | |
60 | VERIFY( !obj.has_infinity ); | |
61 | VERIFY( !obj.has_quiet_NaN ); | |
62 | VERIFY( !obj.has_signaling_NaN ); | |
63 | VERIFY( !obj.has_denorm ); | |
64 | VERIFY( !obj.has_denorm_loss ); | |
65 | VERIFY( obj.infinity() == 0 ); | |
66 | VERIFY( obj.quiet_NaN() == 0 ); | |
67 | VERIFY( obj.signaling_NaN() == 0 ); | |
68 | VERIFY( obj.denorm_min() == 0 ); | |
69 | VERIFY( !obj.is_iec559 ); | |
70 | VERIFY( !obj.is_bounded ); | |
71 | VERIFY( !obj.is_modulo ); | |
72 | VERIFY( !obj.traps ); | |
73 | VERIFY( !obj.tinyness_before ); | |
74 | VERIFY( obj.round_style == std::round_toward_zero ); | |
b2dad0e3 BK |
75 | |
76 | #ifdef DEBUG_ASSERT | |
77 | assert(test); | |
78 | #endif | |
79 | ||
80 | return test; | |
81 | } | |
82 | ||
83 | int main() | |
84 | { | |
85 | test01(); | |
86 | ||
87 | return 0; | |
88 | } |