+#include "gpsim_assert.h"
// Addition tests - mostly int's
/* bit types are not ANSI - so provide a way of disabling bit types
* if this file is used to test other compilers besides SDCC */
-#define SUPPORT_BIT_TYPES 1
+#define SUPPORT_BIT_TYPES 0
-unsigned char success=0;
unsigned char failures=0;
-unsigned char dummy=0;
unsigned int aint0 = 0;
#endif
-void done()
+void
+done()
{
-
- dummy++;
-
+ ASSERT(MANGLE(failures) == 0);
+ PASSED();
}
void add_lit2uint(void)
failures++;
aint1 += aint0;
- if(aint1 != 39)
+ if(aint1 != 0x27)
failures++;
aint2 = aint1 + aint0;
- if(aint2 != 46)
+ if(aint2 != 0x2e)
failures++;
aint3 = aint2 + aint1 + aint0;
- if(aint3 != 92)
+ if(aint3 != 0x5c)
failures++;
+ aint3 += 0xa0;
+ if(aint3 != 0xfc)
+ failures++;
+
+ aint3 += aint0;
+ if(aint3 != 0x103)
+ failures++;
+
+ aint1 += 0xffc0;
+ if(aint1 != 0xffe7)
+ failures++;
+
+ aint3 = aint2 + aint1 + aint0;
+ if(aint3 != 0x1c)
+ failures++;
+
+
}
#if SUPPORT_BIT_TYPES
/* add_bit2uchar(void) - assumes bit0 = 1, aint0 = 7 */
+#if SUPPORT_BIT_TYPES
void add_bit2uchar(void)
{
failures++;
}
+#endif
/***********************************/
aint0=16;
aint1=0;
- // add_uint2uint();
+ add_uint2uint();
aint0 = 0;
aint1 = 32;
- // add_uint2uint2();
+ aint2 = 0;
+ add_uint2uint2();
#if SUPPORT_BIT_TYPES
- // add_bits();
+ add_bits();
+
+ achar0 = 7;
+ add_bit2uchar();
- // add_bit2uchar();
- // add_bit2uint();
+ aint0 = 0;
+ bit0 = 1;
+ add_bit2uint();
#endif
aint0 = 0;
addlits();
- success = failures;
done();
}