1 /** Null character in string tests.
3 storage: __data, __xdata, __code,
8 #pragma disable_warning 147 //no warning about excess elements in array of chars initializer
11 {storage
} char string1
[] = "";
12 {storage
} char string2
[] = "a\0b\0c";
13 {storage
} char string3
[5] = "a\0b\0c";
16 testStringArray (void)
18 /* Make sure the strings are the correct size */
19 /* and have the terminating null character */
20 ASSERT (sizeof (string1
) == 1);
21 ASSERT (sizeof (string2
) == 6);
22 ASSERT (sizeof (string3
) == 5);
23 ASSERT (string1
[0] == 0);
24 ASSERT (string2
[5] == 0);
26 ASSERT (string2
[0]== 'a');
27 ASSERT (string2
[2]== 'b');
28 ASSERT (string2
[4]== 'c');
33 testStringConst (void)
35 const char * constStr1
= "";
36 const char * constStr2
= "a\0b\0c";
38 ASSERT (constStr1
[0] == 0);
39 ASSERT (constStr2
[0] == 'a');
40 ASSERT (constStr2
[1] == 0);
41 ASSERT (constStr2
[2] == 'b');
42 ASSERT (constStr2
[3] == 0);
43 ASSERT (constStr2
[4] == 'c');
44 ASSERT (constStr2
[5] == 0);