2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.benjamin / bool02.C
blobfcdb143a116adaa293dc61c48f1107546e81d095
1 // { dg-do run  }
2 //980324 bkoz
3 //test for bool and bitwise ands
5 #include <assert.h>
8 void bar ( bool  x ) {}
9 void bars ( short  x ) {}
11 #if 0
12 int andb(){
13   bool y;
14   bar ( y );
15   int blob = ( 27 & int (y) );
16   return blob; //expect 1 or 0
18 #endif
20 int andbtrue(){
21   bool y = true;
22   bar ( y );
23   int blob = ( 27 & int (y) );
24   return blob; //expect 1
27 int andbfalse(){
28   bool y = false;
29   bar ( y );
30   int blob = ( 27 & int (y) );
31   return blob; //expect 0
34 int andbfalse2(){
35   bool y = 0;
36   bar ( y );
37   int blob = ( 27 & int (y) );
38   return blob;  //expect 0
41 int ands(){
42   short y = 1;
43   bars ( y );
44   int blob = ( 27 & int (y) );
45   return blob;  //expect 1
49 int main() {
50   int tmp;
51 #if 0
52   tmp = andb();
53   assert (tmp == 1 || tmp == 0);
54 #endif
55   tmp = andbtrue();
56   assert (tmp == 1);
57   tmp = andbfalse();
58   assert (tmp == 0);
59   tmp = andbfalse2();
60   assert (tmp == 0);
61   tmp = ands();
62   assert (tmp == 1);
63   return 0;