Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / tests / bug-460444.c
1 /* bug 460444
2  */
3 #include <testfwk.h>
4
5 void
6 testXOR(void)
7 {
8   volatile int p = 5;
9   
10   if (p ^ 0x60) {
11     // Good.
12   }
13   else {
14     FAIL();
15   }
16
17   /* Test is to see if it compiles. */
18   ASSERT((p^0x60) == 0x65);
19   ASSERT((p&0x61) == 0x01);
20   ASSERT((p|0x60) == 0x65);
21
22   p = 0x1234;
23   if (p ^ 0x5678) {
24     // Good.
25   }
26   else {
27     FAIL();
28   }
29
30   if (p & 0x4324) {
31     // Good
32   }
33   else {
34     FAIL();
35   }
36
37   if (p | 0x1279) {
38     // Good
39   }
40   else {
41     FAIL();
42   }
43 }
44
45 void
46 testLeftRightXor(void)
47 {
48   volatile int left, right;
49
50   left = 0x123;
51   right = 0x8101;
52
53   if (left ^ right) {
54     // Good
55   }
56   else {
57     FAIL();
58   }
59
60   if (left & right) {
61     // Good
62   }
63   else {
64     FAIL();
65   }
66
67   if (left | right) {
68     // Good
69   }
70   else {
71     FAIL();
72   }
73 }