1 /* Check basic behaviour of "flexible array members"
11 struct str1 s11 = { 1, {2, 3} };
12 struct str1 s12 = { 4, {5, 6, 7} }; /* different size */
15 testFlexibleArray1(void)
18 ASSERT(sizeof(s11) == 1);
19 /* test allocation size */
20 #if ! defined(PORT_HOST)
21 ASSERT((char *) &s12 - (char *) &s11 == 1 + 4);
26 /* test initialisation with string */
34 struct str2 s21 = { 1, "sdcc" };
35 struct str2 s22 = { 2, "sdcc is great" }; /* different size */
38 testFlexibleArray2(void)
41 ASSERT(sizeof(s21) == 2);
42 /* test allocation size */
43 #if ! defined(PORT_HOST)
44 ASSERT((char *) &s22 - (char *) &s21 == 2 + 5);