* src/pic/glue.h: added pic14aopLiteral prototype
[fw/sdcc] / support / regression / tests / addsub.c
index ae3ce224ea2f7e114e18eab20736e14fbb2bd90b..3fb3dc1afcf682451a4220a88e0d70ccafa70f54 100644 (file)
@@ -22,6 +22,21 @@ testAdd(void)
   
   result = left+right;
   ASSERT(result == (39-120));
+
+  left = -39;
+  right = 80;
+  
+  result = left+right;
+  ASSERT(result == (-39+80));
+
+  left = -39;
+  right = -70;
+  
+  result = left+right;
+  ASSERT(result == (-39-70));
+
+  result += 0xab00;
+  ASSERT(result == ({type})(0xab00-39-70));
 }
 
 void 
@@ -40,4 +55,19 @@ testSub(void)
   
   result = left-right;
   ASSERT(result == (39+76));
+
+  left = -12;
+  right = 56;
+  
+  result = left-right;
+  ASSERT(result == (-12-56));
+  
+  left = -39;
+  right = -20;
+  
+  result = left-right;
+  ASSERT(result == (-39+20));
+
+  result = left-(signed)0x1200;
+  ASSERT(result == ({type})(-39-(signed)0x1200));
 }