* src/regression/ptrarg.c: added, fails due to bug #1430967
[fw/sdcc] / src / regression / or1.c
1 #include "gpsim_assert.h"
2
3 unsigned char failures=0;
4
5 bit bit0 = 0;
6 bit bit1 = 0;
7 bit bit2 = 0;
8
9 unsigned int uint0 = 0;
10 unsigned int uint1 = 0;
11 unsigned char uchar0 = 0;
12 unsigned char uchar1 = 0;
13 unsigned long ulong0 = 0;
14 unsigned long ulong1 = 0;
15
16 void
17 done()
18 {
19   ASSERT(MANGLE(failures) == 0);
20   PASSED();
21 }
22
23 // uchar0 = 0;
24 void or_lit2uchar(void)
25 {
26
27   if(uchar0)
28     failures++;
29
30   uchar0 |= 1;
31
32   if(uchar0 != 1)
33     failures++;
34
35   uchar0 |= 2;
36
37   if(uchar0 != 3)
38     failures++;
39
40   uchar0 |= 0x0e;
41
42   if(uchar0 != 0x0f)
43     failures++;
44
45 }
46
47
48 void or_lit2uint(void)
49 {
50
51   if(uint0)
52     failures++;
53
54   uint0 |= 1;
55   if(uint0 != 1) 
56     failures++;
57
58   uint0 |= 2;
59   if(uint0 != 3) 
60     failures++;
61
62   uint0 |= 0x100;
63   if(uint0 != 0x103) 
64     failures++;
65
66   uint0 |= 0x102;
67   if(uint0 != 0x103) 
68     failures++;
69
70   uint0 |= 0x303;
71   if(uint0 != 0x303) 
72     failures++;
73
74 }
75
76 void or_lit2ulong(void)
77 {
78
79   if(ulong0)
80     failures++;
81
82   ulong0 |= 1;
83   if(ulong0 != 1) 
84     failures++;
85
86   ulong0 |= 2;
87   if(ulong0 != 3) 
88     failures++;
89
90   ulong0 |= 0x100;
91   if(ulong0 != 0x103) 
92     failures++;
93
94   ulong0 |= 0x102;
95   if(ulong0 != 0x103) 
96     failures++;
97
98   ulong0 |= 0x303;
99   if(ulong0 != 0x303) 
100     failures++;
101
102   ulong0 |= 0x80000000;
103   if(ulong0 != 0x80000303) 
104     failures++;
105
106 }
107
108 /*-----------*/
109 void or_uchar2uchar(void)
110 {
111
112   uchar0 |= uchar1;
113
114   if(uchar0 != 1)
115     failures++;
116
117   uchar1 |= 0x0f;
118
119   uchar0 = uchar1 | 0x10;
120
121   if(uchar0 != 0x1f)
122     failures++;
123 }
124
125 void or_uint2uint(void)
126 {
127   uint0 |= uint1;
128
129   if(uint0 != 1)
130     failures++;
131
132   uint1 |= 0x0f;
133
134   uint0 = uint1 | 0x10;
135
136   if(uint0 != 0x1f)
137     failures++;
138
139 }
140
141 void or_bits1(void)
142 {
143
144   bit0 = bit0 | bit1 | bit2;
145
146 }
147
148 void or_bits2(void)
149 {
150
151   bit0 = bit1 | bit2;
152
153 }
154
155 void main(void)
156 {
157
158   or_lit2uchar();
159   or_lit2uint();
160   or_lit2ulong();
161
162   uchar0=0;
163   uchar1=1;
164   or_uchar2uchar();
165
166   uint0=0;
167   uint1=1;
168   or_uint2uint();
169
170   or_bits1();
171   if(bit0)
172     failures++;
173
174   or_bits2();
175   if(bit0)
176     failures++;
177
178   bit1=1;
179   or_bits1();
180   if(!bit0)
181     failures++;
182
183   or_bits2();
184   if(!bit0)
185     failures++;
186
187
188   done();
189 }