RFE #2484693 and peephole improvements
[fw/sdcc] / src / regression / add3.c
index 3588708646ace9476ba9695e7cc50a3a2dfaefd4..a1990af0c18d2e7cbd7e05938dd16270e8a61c9d 100644 (file)
@@ -1,14 +1,13 @@
+#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;
 
 
 char char0 = 0;
@@ -39,11 +38,11 @@ bit bit11 = 0;
 #endif
 
 
-void done()
+void
+done()
 {
-
-  dummy++;
-
+  ASSERT(MANGLE(failures) == 0);
+  PASSED();
 }
 
 void add_char2char(void)
@@ -68,6 +67,17 @@ void add_char2char(void)
 
 }
 
+void add_compound_char(void)
+{
+  char0 = char1+5;
+
+  if(char0 != 9)
+    failures++;
+
+  if((char0+char1) != 13)
+    failures++;
+}
+
 void add_int2int(void)
 {
   if(int0 != 4)
@@ -85,6 +95,18 @@ void add_int2int(void)
 
 }
 
+void add_compound_int(void)
+{
+  int0 = int1+5;
+
+  if(int0 != 9)
+    failures++;
+
+  if((int0+int1) != 13)
+    failures++;
+}
+
+
 void add_lit2long(void)
 {
 
@@ -179,13 +201,18 @@ void main(void)
   char1 = char0 + 1;
   add_char2char();
 
+  char1=4;
+  add_compound_char();
+
   int0 = 4;
   int1 = int0 + 1;
   add_int2int();
 
+  int1=4;
+  add_compound_int();
+
   add_lit2long();
   add_lit2ulong();
 
-  success = failures;
   done();
 }