struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / scott-struct1.c
blob5f49c700d0fd26fd54dcd221250bdb46d56582ed
1 /*
2 Addition tests
3 */
4 #include <testfwk.h>
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
10 /* Some compilers that support bit types do not support bit arithmetic
11 * (like bitx = bity + bitz;) */
12 #define SUPPORT_BIT_ARITHMETIC 0
14 #if SUPPORT_BIT_TYPES
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;
29 #endif
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;
37 struct chars
39 unsigned char c0, c1;
40 unsigned int i0, i1;
44 struct chars struct1;
46 void
47 struct_test (void)
50 ASSERT (!(struct1.c0 || struct1.c1));
52 struct1.c0++;
54 ASSERT (!(struct1.c0 != 1));
57 void add_chars(void)
60 achar0 = struct1.c0 + struct1.c1;
62 ASSERT(!(achar0 != 1));
65 void
66 testStruct1 (void)
70 struct1.c0 = 0;
71 struct1.c1 = 0;
72 struct_test ();
73 // ptr_to_struct (&struct1);
75 struct1.c0 = 0;
76 struct1.c1 = 1;
77 add_chars();