* src/SDCCmain.c (linkEdit): fixed buffer overflow for gbz80
[fw/sdcc] / support / regression / tests / zeropad.c
1 /** Zeropad tests.
2
3     storage: idata, xdata, code,
4 */
5 #include <testfwk.h>
6
7 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
8 # define data
9 # define idata
10 # define xdata
11 # define code
12 #endif
13
14 struct x {
15   short a;
16   char  b[10];
17 };
18
19 struct x {storage} teststruct[3] = {
20   { 10, {  1, 2, 3, 4, 5} },
21   { 20, { 11 } },
22   { 30, {  6, 7, 8} }
23 };
24
25 void
26 testZeropad(void)
27 {
28   ASSERT(teststruct[0].b[5] ==  0);
29   ASSERT(teststruct[1].b[0] == 11);
30
31   ASSERT(sizeof(teststruct[2].a) ==  2);
32   ASSERT(sizeof(teststruct[1].b) == 10);
33   ASSERT(sizeof(teststruct[1])   == 12);
34   ASSERT(sizeof(teststruct)      == 36);
35 }