struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2732.c
blob4ca7bd80802ca53d43b19e73acbf97bc6f695a2c
1 /* bug-2807.c
2 (s)printf() could not handle %s arguments longer than 127 bytes.
3 */
5 #include <testfwk.h>
7 #include <stdio.h>
9 #if !(defined(__SDCC_mcs51) && (defined(__SDCC_MODEL_SMALL) || defined(__SDCC_MODEL_MEDIUM))) && !defined(__SDCC_pic14) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Array too big to fit in memory.
10 char buffer[260];
11 const char *string = "0123456789abcdef"
12 "0123456789abcdef"
13 "0123456789abcdef"
14 "0123456789abcdef"
15 "0123456789abcdef"
16 "0123456789abcdef"
17 "0123456789abcdef"
18 "0123456789abcdef"
19 "0123456789abcdef"
20 "0123456789abcdef"
21 "0123456789abcdef"
22 "0123456789abcdef"
23 "0123456789abcdef"
24 "0123456789abcdef"
25 "0123456789abcdef"
26 "0123456789abcdef"
27 "t"; // 257 bytes excluding terminating 0.
28 #endif
30 void testBug(void)
32 #if !(defined(__SDCC_mcs51) && (defined(__SDCC_MODEL_SMALL) || defined(__SDCC_MODEL_MEDIUM))) && !defined(__SDCC_pic14) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Array too big to fit in memory.
33 sprintf (buffer, "X%sX", string);
35 ASSERT (buffer[0] == 'X');
36 ASSERT (buffer[1] == '0');
37 ASSERT (buffer[256] == 'f');
38 ASSERT (buffer[257] == 't');
39 ASSERT (buffer[258] == 'X');
40 ASSERT (buffer[259] == 0);
41 #endif