ae3ce224ea2f7e114e18eab20736e14fbb2bd90b
[fw/sdcc] / support / regression / tests / addsub.c
1 /** Add, sub tests.
2
3     type: signed char, int, long
4     storage: static, 
5     attr: volatile
6 */
7 #include <testfwk.h>
8
9 void 
10 testAdd(void)
11 {
12   {storage} {attr} {type} left, right, result;
13
14   left = 5;
15   right = 26;
16
17   result = left+right;
18   ASSERT(result == 31);
19   
20   left = 39;
21   right = -120;
22   
23   result = left+right;
24   ASSERT(result == (39-120));
25 }
26
27 void 
28 testSub(void)
29 {
30   {storage} {attr} {type} left, right, result;
31
32   left = 5;
33   right = 26;
34
35   result = left-right;
36   ASSERT(result == (5-26));
37   
38   left = 39;
39   right = -76;
40   
41   result = left-right;
42   ASSERT(result == (39+76));
43 }