1 #include "gpsim_assert.h"
3 // Signed comparisons of the form: (variable<LIT)
5 // This regression test exercises all of the boundary
6 // conditions in literal less than comparisons. There
7 // are numerous opportunities to optimize these comparison
8 // and each one has an astonishing capability of failing
9 // a boundary condition.
11 unsigned char failures = 0;
12 unsigned char result = 0;
17 signed char char0 = 0;
18 signed char char1 = 0;
23 /* *** NOTE *** This particular test takes quite a while to run
24 * ~ 10,000,000 instruction cycles. (2.5 seconds on a 20Mhz PIC).
25 * The WDT will reset the CPU if it's enabled. So disable it...
28 typedef unsigned int word;
30 //word at 0x2007 CONFIG = wdt_off & pwrte_on;
35 ASSERT(MANGLE(failures) == 0);
39 void c_char_lt_lit1(unsigned char expected_result)
59 if(result != expected_result)
64 void char_compare(void)
100 c_char_lt_lit1(0x1f);
103 /* Now test entire range */
105 for(char0=1; char0 != 0x7f; char0++)
106 c_char_lt_lit1(0x10);
109 for(char0=-0x7f; char0 != -1; char0++)
110 c_char_lt_lit1(0x1e);
115 void c_int_lt_lit1(unsigned char expected_result)
144 if(result != expected_result)
150 void int_compare1(void)
191 /* now check contiguous ranges */
193 for(int0 = -0x7fff; int0 != -1; int0++)
196 for(int0 = 1; int0 != 0xff; int0++)
199 for(int0 = 0x201; int0 != 0x7fff; int0++)
206 void c_int_lt_lit2(unsigned char expected_result)
234 if(result != expected_result)
238 void int_compare2(void)
285 /* now check contiguous ranges */
289 for(int0 = -0x7ffe; int0 != -0x7f01; int0++)
292 for(int0 = -0x7e00; int0 != -0x101; int0++)
295 for(int0 = -1; int0 != 0x7fff; int0++)