scummvm random work
[patches.git] / uClibc-0.9.29-libc_string_tester_memcmp.diff
1 --- /tmp/test/string/tester.c.orig 2007-10-27 19:36:22.998411224 +0200
2 +++ /tmp/test/string/tester.c 2007-10-27 19:36:08.118673288 +0200
3 @@ -1087,15 +1087,31 @@
4 static void
5 test_memcmp (void)
6 {
7 + int i, cnt = 1;
8 + char one[21], two[21];
9 +
10 it = "memcmp";
11 - check(memcmp("a", "a", 1) == 0, 1); /* Identity. */
12 - check(memcmp("abc", "abc", 3) == 0, 2); /* Multicharacter. */
13 - check(memcmp("abcd", "abce", 4) < 0, 3); /* Honestly unequal. */
14 - check(memcmp("abce", "abcd", 4) > 0, 4);
15 - check(memcmp("alph", "beta", 4) < 0, 5);
16 - check(memcmp("a\203", "a\003", 2) > 0, 6);
17 - check(memcmp("abce", "abcd", 3) == 0, 7); /* Count limited. */
18 - check(memcmp("abc", "def", 0) == 0, 8); /* Zero count. */
19 + check(memcmp("a", "a", 1) == 0, cnt++); /* Identity. */
20 + check(memcmp("abc", "abc", 3) == 0, cnt++); /* Multicharacter. */
21 + check(memcmp("abcd", "abcf", 4) < 0, cnt++); /* Honestly unequal. */
22 + check(memcmp("abcf", "abcd", 4) > 0, cnt++);
23 + check(memcmp("alph", "cold", 4) < 0, cnt++);
24 + check(memcmp("a\203", "a\003", 2) > 0, cnt++);
25 + check(memcmp("a\003", "a\203", 2) < 0, cnt++);
26 + check(memcmp("a\003bc", "a\203bc", 2) < 0, cnt++);
27 + check(memcmp("abc\203", "abc\003", 4) > 0, cnt++);
28 + check(memcmp("abc\003", "abc\203", 4) < 0, cnt++);
29 + check(memcmp("abcf", "abcd", 3) == 0, cnt++); /* Count limited. */
30 + check(memcmp("abc", "def", 0) == 0, cnt++); /* Zero count. */
31 + /* Comparisons with shifting 4-byte boundaries. */
32 + for (i=0; i<4; i++)
33 + {
34 + char *a = one + i, *b = two + i;
35 + strncpy( a, "--------11112222", 16);
36 + strncpy( b, "--------33334444", 16);
37 + check( memcmp(b, a, 16) > 0, cnt++);
38 + check( memcmp(a, b, 16) < 0, cnt++);
39 + }
40 }
41
42 static void