struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-divcmp-1.c
blob3f5cdbd3ade9bb6df68feb371dc645492ae51467
1 /*
2 divcmp-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 extern void abort(void);
13 int test1(int x)
15 return x/10 == 2;
18 int test1u(unsigned int x)
20 return x/10U == 2;
23 #ifndef __SDCC_pdk14 // Lack of memory
24 int test2(int x)
26 return x/10 == 0;
29 int test2u(unsigned int x)
31 return x/10U == 0;
34 #ifndef __SDCC_pdk15 // Lack of memory
35 int test3(int x)
37 return x/10 != 2;
40 int test3u(unsigned int x)
42 return x/10U != 2;
45 int test4(int x)
47 return x/10 != 0;
50 int test4u(unsigned int x)
52 return x/10U != 0;
55 int test5(int x)
57 return x/10 < 2;
60 int test5u(unsigned int x)
62 return x/10U < 2;
65 int test6(int x)
67 return x/10 < 0;
70 int test7(int x)
72 return x/10 <= 2;
75 int test7u(unsigned int x)
77 return x/10U <= 2;
80 int test8(int x)
82 return x/10 <= 0;
85 int test8u(unsigned int x)
87 return x/10U <= 0;
90 int test9(int x)
92 return x/10 > 2;
95 int test9u(unsigned int x)
97 return x/10U > 2;
100 int test10(int x)
102 return x/10 > 0;
105 int test10u(unsigned int x)
107 return x/10U > 0;
110 int test11(int x)
112 return x/10 >= 2;
115 int test11u(unsigned int x)
117 return x/10U >= 2;
120 int test12(int x)
122 return x/10 >= 0;
124 #endif
125 #endif
127 void
128 testTortureExecute (void)
130 if (test1(19) != 0)
131 ASSERT (0);
132 if (test1(20) != 1)
133 ASSERT (0);
134 if (test1(29) != 1)
135 ASSERT (0);
136 if (test1(30) != 0)
137 ASSERT (0);
139 if (test1u(19) != 0)
140 ASSERT (0);
141 if (test1u(20) != 1)
142 ASSERT (0);
143 if (test1u(29) != 1)
144 ASSERT (0);
145 if (test1u(30) != 0)
146 ASSERT (0);
148 #if !defined(__SDCC_pdk14) // Lack of memory
149 if (test2(0) != 1)
150 ASSERT (0);
151 if (test2(9) != 1)
152 ASSERT (0);
153 if (test2(10) != 0)
154 ASSERT (0);
155 if (test2(-1) != 1)
156 ASSERT (0);
157 if (test2(-9) != 1)
158 ASSERT (0);
159 if (test2(-10) != 0)
160 ASSERT (0);
162 if (test2u(0) != 1)
163 ASSERT (0);
164 if (test2u(9) != 1)
165 ASSERT (0);
166 if (test2u(10) != 0)
167 ASSERT (0);
168 if (test2u(-1) != 0)
169 ASSERT (0);
170 if (test2u(-9) != 0)
171 ASSERT (0);
172 if (test2u(-10) != 0)
173 ASSERT (0);
174 #if !defined(__SDCC_pdk15) // Lack of memory
175 if (test3(19) != 1)
176 ASSERT (0);
177 if (test3(20) != 0)
178 ASSERT (0);
179 if (test3(29) != 0)
180 ASSERT (0);
181 if (test3(30) != 1)
182 ASSERT (0);
184 if (test3u(19) != 1)
185 ASSERT (0);
186 if (test3u(20) != 0)
187 ASSERT (0);
188 if (test3u(29) != 0)
189 ASSERT (0);
190 if (test3u(30) != 1)
191 ASSERT (0);
193 if (test4(0) != 0)
194 ASSERT (0);
195 if (test4(9) != 0)
196 ASSERT (0);
197 if (test4(10) != 1)
198 ASSERT (0);
199 if (test4(-1) != 0)
200 ASSERT (0);
201 if (test4(-9) != 0)
202 ASSERT (0);
203 if (test4(-10) != 1)
204 ASSERT (0);
206 if (test4u(0) != 0)
207 ASSERT (0);
208 if (test4u(9) != 0)
209 ASSERT (0);
210 if (test4u(10) != 1)
211 ASSERT (0);
212 if (test4u(-1) != 1)
213 ASSERT (0);
214 if (test4u(-9) != 1)
215 ASSERT (0);
216 if (test4u(-10) != 1)
217 ASSERT (0);
219 if (test5(19) != 1)
220 ASSERT (0);
221 if (test5(20) != 0)
222 ASSERT (0);
223 if (test5(29) != 0)
224 ASSERT (0);
225 if (test5(30) != 0)
226 ASSERT (0);
228 if (test5u(19) != 1)
229 ASSERT (0);
230 if (test5u(20) != 0)
231 ASSERT (0);
232 if (test5u(29) != 0)
233 ASSERT (0);
234 if (test5u(30) != 0)
235 ASSERT (0);
237 if (test6(0) != 0)
238 ASSERT (0);
239 if (test6(9) != 0)
240 ASSERT (0);
241 if (test6(10) != 0)
242 ASSERT (0);
243 if (test6(-1) != 0)
244 ASSERT (0);
245 if (test6(-9) != 0)
246 ASSERT (0);
247 if (test6(-10) != 1)
248 ASSERT (0);
250 if (test7(19) != 1)
251 ASSERT (0);
252 if (test7(20) != 1)
253 ASSERT (0);
254 if (test7(29) != 1)
255 ASSERT (0);
256 if (test7(30) != 0)
257 ASSERT (0);
259 if (test7u(19) != 1)
260 ASSERT (0);
261 if (test7u(20) != 1)
262 ASSERT (0);
263 if (test7u(29) != 1)
264 ASSERT (0);
265 if (test7u(30) != 0)
266 ASSERT (0);
268 if (test8(0) != 1)
269 ASSERT (0);
270 if (test8(9) != 1)
271 ASSERT (0);
272 if (test8(10) != 0)
273 ASSERT (0);
274 if (test8(-1) != 1)
275 ASSERT (0);
276 if (test8(-9) != 1)
277 ASSERT (0);
278 if (test8(-10) != 1)
279 ASSERT (0);
281 if (test8u(0) != 1)
282 ASSERT (0);
283 if (test8u(9) != 1)
284 ASSERT (0);
285 if (test8u(10) != 0)
286 ASSERT (0);
287 if (test8u(-1) != 0)
288 ASSERT (0);
289 if (test8u(-9) != 0)
290 ASSERT (0);
291 if (test8u(-10) != 0)
292 ASSERT (0);
294 if (test9(19) != 0)
295 ASSERT (0);
296 if (test9(20) != 0)
297 ASSERT (0);
298 if (test9(29) != 0)
299 ASSERT (0);
300 if (test9(30) != 1)
301 ASSERT (0);
303 if (test9u(19) != 0)
304 ASSERT (0);
305 if (test9u(20) != 0)
306 ASSERT (0);
307 if (test9u(29) != 0)
308 ASSERT (0);
309 if (test9u(30) != 1)
310 ASSERT (0);
312 if (test10(0) != 0)
313 ASSERT (0);
314 if (test10(9) != 0)
315 ASSERT (0);
316 if (test10(10) != 1)
317 ASSERT (0);
318 if (test10(-1) != 0)
319 ASSERT (0);
320 if (test10(-9) != 0)
321 ASSERT (0);
322 if (test10(-10) != 0)
323 ASSERT (0);
325 if (test10u(0) != 0)
326 ASSERT (0);
327 if (test10u(9) != 0)
328 ASSERT (0);
329 if (test10u(10) != 1)
330 ASSERT (0);
331 if (test10u(-1) != 1)
332 ASSERT (0);
333 if (test10u(-9) != 1)
334 ASSERT (0);
335 if (test10u(-10) != 1)
336 ASSERT (0);
338 if (test11(19) != 0)
339 ASSERT (0);
340 if (test11(20) != 1)
341 ASSERT (0);
342 if (test11(29) != 1)
343 ASSERT (0);
344 if (test11(30) != 1)
345 ASSERT (0);
347 if (test11u(19) != 0)
348 ASSERT (0);
349 if (test11u(20) != 1)
350 ASSERT (0);
351 if (test11u(29) != 1)
352 ASSERT (0);
353 if (test11u(30) != 1)
354 ASSERT (0);
356 if (test12(0) != 1)
357 ASSERT (0);
358 if (test12(9) != 1)
359 ASSERT (0);
360 if (test12(10) != 1)
361 ASSERT (0);
362 if (test12(-1) != 1)
363 ASSERT (0);
364 if (test12(-9) != 1)
365 ASSERT (0);
366 if (test12(-10) != 0)
367 ASSERT (0);
369 return;
370 #endif
371 #endif