1 // Signed comparisons of the form: (variable<=LIT)
3 // This regression test exercises all of the boundary
4 // conditions in literal less than or equal comparisons. There
5 // are numerous opportunities to optimize these comparison
6 // and each one has an astonishing capability of failing
7 // a boundary condition.
9 unsigned char success = 0;
10 unsigned char failures = 0;
11 unsigned char dummy = 0;
12 unsigned char result = 0;
16 signed char char0 = 0;
17 signed char char1 = 0;
26 void c_char_lte_lit1(unsigned char expected_result)
45 if(result != expected_result)
50 void char_compare(void)
53 c_char_lte_lit1(0x10);
56 c_char_lte_lit1(0x10);
59 c_char_lte_lit1(0x10);
62 c_char_lte_lit1(0x10);
65 c_char_lte_lit1(0x18);
68 c_char_lte_lit1(0x1c);
71 c_char_lte_lit1(0x1e);
74 c_char_lte_lit1(0x1e);
77 c_char_lte_lit1(0x1e);
80 c_char_lte_lit1(0x1e);
83 c_char_lte_lit1(0x1f);
86 // c_char_lte_lit1(0x1f);
89 /* Now test entire range */
91 for(char0=2; char0 != 0x7f; char0++)
92 c_char_lte_lit1(0x10);
95 for(char0=-0x7e; char0 != 0; char0++)
96 c_char_lte_lit1(0x1e);
101 void c_int_lte_lit1(unsigned char expected_result)
130 if(result != expected_result)
136 void int_compare1(void)
139 c_int_lte_lit1(0xff);
142 c_int_lte_lit1(0xff);
145 c_int_lte_lit1(0xfe);
148 c_int_lte_lit1(0xfc);
151 c_int_lte_lit1(0xfc);
154 c_int_lte_lit1(0xfc);
157 c_int_lte_lit1(0xf8);
160 c_int_lte_lit1(0xf0);
163 c_int_lte_lit1(0xe0);
166 c_int_lte_lit1(0xe0);
169 c_int_lte_lit1(0xc0);
172 c_int_lte_lit1(0x80);
177 /* now check contiguous ranges */
179 for(int0 = -0x7fff; int0 != 1; int0++)
180 c_int_lte_lit1(0xff);
182 for(int0 = 2; int0 != 0xff; int0++)
183 c_int_lte_lit1(0xfc);
185 for(int0 = 0x202; int0 != 0x7fff; int0++)
192 void c_int_lte_lit2(unsigned char expected_result)
220 if(result != expected_result)
224 void int_compare2(void)
227 c_int_lte_lit2(0xff);
230 c_int_lte_lit2(0xfe);
233 c_int_lte_lit2(0xfc);
236 c_int_lte_lit2(0xf8);
239 c_int_lte_lit2(0xf0);
242 c_int_lte_lit2(0xf0);
245 c_int_lte_lit2(0xf0);
248 c_int_lte_lit2(0xf0);
251 c_int_lte_lit2(0xe0);
254 c_int_lte_lit2(0xc0);
257 c_int_lte_lit2(0x80);
260 c_int_lte_lit2(0x80);
263 c_int_lte_lit2(0x00);
266 c_int_lte_lit2(0x00);
269 c_int_lte_lit2(0x00);
271 /* now check contiguous ranges */
273 for(int0 = -0x7ffe; int0 != -0x7f00; int0++)
274 c_int_lte_lit2(0xfe);
276 for(int0 = -0x7dff; int0 != -0x101; int0++)
277 c_int_lte_lit2(0xf0);
279 for(int0 = 0; int0 != 0x7fff; int0++)