1 /** tests for string comparison functions, in particular for the handling of non-printable characters.
2 In bug #3728, the sign waas wrong on the strcmp result for some string with characters outside the ASCII range.
8 const unsigned char s0
[] = {0, 0};
9 const unsigned char s1
[] = {1, 0};
10 const unsigned char s100
[] = {100, 0};
11 const unsigned char s200
[] = {200, 0};
16 ASSERT (strcmp(s0
, s1
) < 0);
17 ASSERT (strncmp(s0
, s1
, 2) < 0);
18 ASSERT (memcmp(s0
, s1
, 2) < 0);
19 ASSERT (strcmp(s0
, s100
) < 0);
20 ASSERT (strncmp(s0
, s100
, 2) < 0);
21 ASSERT (memcmp(s0
, s100
, 2) < 0);
22 ASSERT (strcmp(s0
, s200
) < 0);
23 ASSERT (strncmp(s0
, s200
, 2) < 0);
24 ASSERT (memcmp(s0
, s200
, 2) < 0);
25 ASSERT (strcmp(s100
, s200
) < 0);
26 ASSERT (strncmp(s100
, s200
, 2) < 0);
27 ASSERT (memcmp(s100
, s200
, 2) < 0);
28 ASSERT (strcmp(s1
, s0
) > 0);
29 ASSERT (strncmp(s1
, s0
, 2) > 0);
30 ASSERT (memcmp(s1
, s0
, 2) > 0);
31 ASSERT (strcmp(s100
, s0
) > 0);
32 ASSERT (strncmp(s100
, s0
, 2) > 0);
33 ASSERT (memcmp(s100
, s0
, 2) > 0);
34 #if !defined(__SDCC_pdk13) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
35 ASSERT (strcmp(s200
, s1
) > 0);
36 ASSERT (strncmp(s200
, s1
, 2) > 0);
37 ASSERT (memcmp(s200
, s1
, 2) > 0);
38 ASSERT (strcmp(s200
, s100
) > 0);
39 ASSERT (strncmp(s200
, s100
, 2) > 0);
40 ASSERT (memcmp(s200
, s100
, 2) > 0);