]>
Commit | Line | Data |
---|---|---|
b2dad0e3 BK |
1 | // 1999-05-20 bkoz |
2 | ||
3 | // Copyright (C) 1999 Free Software Foundation, Inc. | |
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 | // 17.4.1.2 Headers, ciso646 | |
22 | ||
db4a7a8a GDR |
23 | // { dg-do link } |
24 | ||
b2dad0e3 | 25 | #include <ciso646> |
aa1b2f7d | 26 | #include <debug_assert.h> |
b2dad0e3 BK |
27 | |
28 | ||
29 | // 2.11 Keywords | |
30 | // alternative representations | |
31 | // and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq | |
32 | ||
33 | // C 2.2.2 Header <iso646.h> | |
34 | // The tokens (as above) are keywords and do not appear as macros in <ciso646>. | |
35 | ||
36 | // Test for macros. | |
37 | bool test01() | |
38 | { | |
39 | bool test = true; | |
40 | ||
11489a95 BK |
41 | #if 0 |
42 | ||
b2dad0e3 BK |
43 | #ifdef and |
44 | test = false; | |
45 | #endif | |
46 | ||
47 | #ifdef and_eq | |
48 | test = false; | |
49 | #endif | |
50 | ||
51 | #ifdef bitand | |
52 | test = false; | |
53 | #endif | |
54 | ||
55 | #ifdef bitor | |
56 | test = false; | |
57 | #endif | |
58 | ||
59 | #ifdef compl | |
60 | test = false; | |
61 | #endif | |
62 | ||
63 | #ifdef not_eq | |
64 | test = false; | |
65 | #endif | |
66 | ||
67 | #ifdef not_or | |
68 | test = false; | |
69 | #endif | |
70 | ||
71 | #ifdef or | |
72 | test = false; | |
73 | #endif | |
74 | ||
75 | #ifdef or_eq | |
76 | test = false; | |
77 | #endif | |
78 | ||
79 | #ifdef xor | |
80 | test = false; | |
81 | #endif | |
82 | ||
83 | #ifdef xor_eq | |
84 | test = false; | |
85 | #endif | |
86 | ||
11489a95 BK |
87 | #endif |
88 | ||
b2dad0e3 BK |
89 | #ifdef DEBUG_ASSERT |
90 | assert(test); | |
91 | #endif | |
92 | ||
93 | return test; | |
94 | } | |
95 | ||
96 | ||
97 | // Equivalance in usage. | |
98 | bool test02() | |
99 | { | |
100 | bool test = true; | |
101 | ||
102 | bool arg1 = true; | |
103 | bool arg2 = false; | |
104 | int int1 = 45; | |
105 | int int2 = 0; | |
106 | ||
aa1b2f7d BV |
107 | VERIFY( arg1 && int1 ); |
108 | VERIFY( arg1 and int1 ); | |
b2dad0e3 | 109 | |
aa1b2f7d BV |
110 | VERIFY( (arg1 && arg2) == (arg1 and arg2) ); |
111 | VERIFY( (arg1 && int1) == (arg1 and int1) ); | |
b2dad0e3 BK |
112 | |
113 | #ifdef DEBUG_ASSERT | |
114 | assert(test); | |
115 | #endif | |
116 | ||
117 | return test; | |
118 | } | |
119 | ||
120 | ||
121 | int main(void) | |
122 | { | |
123 | test01(); | |
124 | test02(); | |
125 | ||
126 | return 0; | |
127 | } |