FSF GCC merge 02/23/03
[official-gcc.git] / libstdc++-v3 / testsuite / 17_intro / header_ciso646.cc
blob8513b0864efcd68b8b33373e3a10a2917d3834ec
1 // 1999-05-20 bkoz
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.
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.
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.
21 // 17.4.1.2 Headers, ciso646
23 // { dg-do link }
25 #include <ciso646>
26 #include <testsuite_hooks.h>
29 // 2.11 Keywords
30 // alternative representations
31 // and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
33 // C 2.2.2 Header <iso646.h>
34 // The tokens (as above) are keywords and do not appear as macros in <ciso646>.
36 // Test for macros.
37 bool test01()
39 bool test = true;
41 #if 0
43 #ifdef and
44 test = false;
45 #endif
47 #ifdef and_eq
48 test = false;
49 #endif
51 #ifdef bitand
52 test = false;
53 #endif
55 #ifdef bitor
56 test = false;
57 #endif
59 #ifdef compl
60 test = false;
61 #endif
63 #ifdef not_eq
64 test = false;
65 #endif
67 #ifdef not_or
68 test = false;
69 #endif
71 #ifdef or
72 test = false;
73 #endif
75 #ifdef or_eq
76 test = false;
77 #endif
79 #ifdef xor
80 test = false;
81 #endif
83 #ifdef xor_eq
84 test = false;
85 #endif
87 #endif
89 #ifdef DEBUG_ASSERT
90 assert(test);
91 #endif
93 return test;
97 // Equivalance in usage.
98 bool test02()
100 bool test = true;
102 bool arg1 = true;
103 bool arg2 = false;
104 int int1 = 45;
105 int int2 = 0;
107 VERIFY( arg1 && int1 );
108 VERIFY( arg1 and int1 );
110 VERIFY( (arg1 && arg2) == (arg1 and arg2) );
111 VERIFY( (arg1 && int1) == (arg1 and int1) );
113 #ifdef DEBUG_ASSERT
114 assert(test);
115 #endif
117 return test;
121 int main(void)
123 test01();
124 test02();
126 return 0;