Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / tests / scott-struct1.c
1 /*
2   Addition tests
3 */
4 #include <testfwk.h>
5
6 /* bit types are not ANSI - so provide a way of disabling bit types
7  * if this file is used to test other compilers besides SDCC */
8 #define SUPPORT_BIT_TYPES 0
9
10 /* Some compilers that support bit types do not support bit arithmetic 
11  * (like bitx = bity + bitz;) */
12 #define SUPPORT_BIT_ARITHMETIC 0
13
14 #if SUPPORT_BIT_TYPES
15
16 bit bit0 = 0;
17 bit bit1 = 0;
18 bit bit2 = 0;
19 bit bit3 = 0;
20 bit bit4 = 0;
21 bit bit5 = 0;
22 bit bit6 = 0;
23 bit bit7 = 0;
24 bit bit8 = 0;
25 bit bit9 = 0;
26 bit bit10 = 0;
27 bit bit11 = 0;
28
29 #endif
30
31 unsigned int aint0 = 0;
32 unsigned int aint1 = 0;
33 unsigned char achar0 = 0;
34 unsigned char achar1 = 0;
35 unsigned char *acharP = 0;
36
37 struct chars
38   {
39     unsigned char c0, c1;
40     unsigned int  i0, i1;
41   };
42
43
44 struct chars struct1;
45
46 void
47 struct_test (void)
48 {
49
50   ASSERT (!(struct1.c0 || struct1.c1));
51
52   struct1.c0++;
53
54   ASSERT (!(struct1.c0 != 1));
55 }
56
57 void add_chars(void)
58 {
59
60   achar0 = struct1.c0 + struct1.c1;
61
62   ASSERT(!(achar0 != 1));
63 }
64
65 void
66 testStruct1 (void)
67 {
68
69
70   struct1.c0 = 0;
71   struct1.c1 = 0;
72   struct_test ();
73   //  ptr_to_struct (&struct1);
74
75   struct1.c0 = 0;
76   struct1.c1 = 1;
77   add_chars();
78 }