2 !!DESCRIPTION!! Addition tests - mostly int's
3 !!ORIGIN!! SDCC regression tests
4 !!LICENCE!! GPL, read COPYING.GPL
13 unsigned char failures=0;
29 make sure the reference output uses types with
35 #ifdef SIZEOF_INT_16BIT
53 unsigned long ulong0 = 0;
54 unsigned long ulong1 = 0;
58 #ifdef SUPPORT_BIT_TYPES
77 printf("%s done - failures: %d\n", name, failures);
83 void add_char2char(void)
90 char0 = char0 + char1;
97 #if (!defined(REFCC) && defined(UNSIGNED_CHARS)) || (defined(REFCC) && defined(REFCC_UNSIGNED_CHARS))
111 done("add_char2char");
114 void add_compound_char(void)
121 if((char0+char1) != 13)
124 done("add_compound_char");
127 void add_int2int(void)
145 void add_compound_int(void)
152 if((int0+int1) != 13)
155 done("add_compound_int");
158 void add_lit2long(void)
168 long0 = long0 + 0xff;
173 long0 = long0 + 0x100;
177 long0 = long0 + 0xfe00;
181 long0 = long0 + 0xff0000;
182 if(long0 != 0x1000000)
185 long0 = long0 + 0x7e000000;
186 if(long0 != 0x7f000000)
189 /* wrap around zero */
190 long0 = long0 + 0x2000000;
191 if(long0 != -0x7f000000)
194 long0 = long0 + 0x7f000000;
198 done("add_lit2long");
201 void add_lit2ulong(void)
211 ulong0 = ulong0 + 0xff;
216 ulong0 = ulong0 + 0x100;
220 ulong0 = ulong0 + 0xfe00;
221 if(ulong0 != 0x10000)
224 ulong0 = ulong0 + 0xff0000;
225 if(ulong0 != 0x1000000)
228 ulong0 = ulong0 + 0x7e000000;
229 if(ulong0 != 0x7f000000)
232 ulong0 = ulong0 + 0x2000000;
233 if(ulong0 != 0x81000000)
236 /* wrap around zero */
237 ulong0 = ulong0 + 0x7f000000;
241 done("add_lit2ulong");