@@ -1,3 +1,16 @@
+2016-05-30 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * string/test-strncmp.c [WIDE] (MIDCHAR): Defined.
+ [WIDE} (LARGECHAR): Likewise.
+ (MIDCHAR): Likewise.
+ (LARGECHAR): Likewise.
+ (test_main): Adapted to operate on with wide chars.
+
+2016-05-25 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * string/test-strncmp.c (do_test): ALIGN is an offset to CHAR*
+ pointers, not char*.
+
2016-05-24 Joseph Myers <joseph@codesourcery.com>
[BZ #15479]
@@ -38,6 +38,8 @@
# define CHAR wchar_t
# define UCHAR wchar_t
# define CHARBYTES 4
+# define MIDCHAR 0x7fffffff
+# define LARGECHAR 0xfffffffe
# define CHAR__MAX WCHAR_MAX
# define CHAR__MIN WCHAR_MIN
@@ -88,6 +90,8 @@ stupid_wcsncmp (const CHAR *s1, const CHAR *s2, size_t n)
# define CHAR char
# define UCHAR unsigned char
# define CHARBYTES 1
+# define MIDCHAR 0x7f
+# define LARGECHAR 0xfe
# define CHAR__MAX CHAR_MAX
# define CHAR__MIN CHAR_MIN
@@ -414,56 +418,56 @@ test_main (void)
for (i =0; i < 16; ++i)
{
- do_test (0, 0, 8, i, 127, 0);
- do_test (0, 0, 8, i, 127, -1);
- do_test (0, 0, 8, i, 127, 1);
- do_test (i, i, 8, i, 127, 0);
- do_test (i, i, 8, i, 127, 1);
- do_test (i, i, 8, i, 127, -1);
- do_test (i, 2 * i, 8, i, 127, 0);
- do_test (2 * i, i, 8, i, 127, 1);
- do_test (i, 3 * i, 8, i, 127, -1);
- do_test (0, 0, 8, i, 255, 0);
- do_test (0, 0, 8, i, 255, -1);
- do_test (0, 0, 8, i, 255, 1);
- do_test (i, i, 8, i, 255, 0);
- do_test (i, i, 8, i, 255, 1);
- do_test (i, i, 8, i, 255, -1);
- do_test (i, 2 * i, 8, i, 255, 0);
- do_test (2 * i, i, 8, i, 255, 1);
- do_test (i, 3 * i, 8, i, 255, -1);
+ do_test (0, 0, 8, i, MIDCHAR, 0);
+ do_test (0, 0, 8, i, MIDCHAR, -1);
+ do_test (0, 0, 8, i, MIDCHAR, 1);
+ do_test (CHARBYTES * i, CHARBYTES * i, 8, i, MIDCHAR, 0);
+ do_test (CHARBYTES * i, CHARBYTES * i, 8, i, MIDCHAR, 1);
+ do_test (CHARBYTES * i, CHARBYTES * i, 8, i, MIDCHAR, -1);
+ do_test (CHARBYTES * i, 2 * CHARBYTES * i, 8, i, MIDCHAR, 0);
+ do_test (2 * CHARBYTES * i, CHARBYTES * i, 8, i, MIDCHAR, 1);
+ do_test (CHARBYTES * i, 3 * CHARBYTES * i, 8, i, MIDCHAR, -1);
+ do_test (0, 0, 8, i, LARGECHAR, 0);
+ do_test (0, 0, 8, i, LARGECHAR, -1);
+ do_test (0, 0, 8, i, LARGECHAR, 1);
+ do_test (CHARBYTES * i, CHARBYTES * i, 8, i, LARGECHAR, 0);
+ do_test (CHARBYTES * i, CHARBYTES * i, 8, i, LARGECHAR, 1);
+ do_test (CHARBYTES * i, CHARBYTES * i, 8, i, LARGECHAR, -1);
+ do_test (CHARBYTES * i, 2 * CHARBYTES * i, 8, i, LARGECHAR, 0);
+ do_test (2 * CHARBYTES * i, CHARBYTES * i, 8, i, LARGECHAR, 1);
+ do_test (CHARBYTES * i, 3 * CHARBYTES * i, 8, i, LARGECHAR, -1);
}
for (i = 1; i < 8; ++i)
{
- do_test (0, 0, 8 << i, 16 << i, 127, 0);
- do_test (0, 0, 8 << i, 16 << i, 127, 1);
- do_test (0, 0, 8 << i, 16 << i, 127, -1);
- do_test (0, 0, 8 << i, 16 << i, 255, 0);
- do_test (0, 0, 8 << i, 16 << i, 255, 1);
- do_test (0, 0, 8 << i, 16 << i, 255, -1);
- do_test (8 - i, 2 * i, 8 << i, 16 << i, 127, 0);
- do_test (8 - i, 2 * i, 8 << i, 16 << i, 127, 1);
- do_test (2 * i, i, 8 << i, 16 << i, 255, 0);
- do_test (2 * i, i, 8 << i, 16 << i, 255, 1);
+ do_test (0, 0, 8 << i, 16 << i, MIDCHAR, 0);
+ do_test (0, 0, 8 << i, 16 << i, MIDCHAR, 1);
+ do_test (0, 0, 8 << i, 16 << i, MIDCHAR, -1);
+ do_test (0, 0, 8 << i, 16 << i, LARGECHAR, 0);
+ do_test (0, 0, 8 << i, 16 << i, LARGECHAR, 1);
+ do_test (0, 0, 8 << i, 16 << i, LARGECHAR, -1);
+ do_test (CHARBYTES * (8 - i), 2 * CHARBYTES * i, 8 << i, 16 << i, MIDCHAR, 0);
+ do_test (CHARBYTES * (8 - i), 2 * CHARBYTES * i, 8 << i, 16 << i, MIDCHAR, 1);
+ do_test (2 * CHARBYTES * i, CHARBYTES * i, 8 << i, 16 << i, LARGECHAR, 0);
+ do_test (2 * CHARBYTES * i, CHARBYTES * i, 8 << i, 16 << i, LARGECHAR, 1);
}
- do_test_limit (0, 0, 0, 0, 127, 0);
- do_test_limit (4, 0, 21, 20, 127, 0);
- do_test_limit (0, 4, 21, 20, 127, 0);
- do_test_limit (8, 0, 25, 24, 127, 0);
- do_test_limit (0, 8, 25, 24, 127, 0);
+ do_test_limit (0, 0, 0, 0, MIDCHAR, 0);
+ do_test_limit (CHARBYTES * 4, 0, 21, 20, MIDCHAR, 0);
+ do_test_limit (0, CHARBYTES * 4, 21, 20, MIDCHAR, 0);
+ do_test_limit (CHARBYTES * 8, 0, 25, 24, MIDCHAR, 0);
+ do_test_limit (0, CHARBYTES * 8, 25, 24, MIDCHAR, 0);
for (i = 0; i < 8; ++i)
{
- do_test_limit (0, 0, 17 - i, 16 - i, 127, 0);
- do_test_limit (0, 0, 17 - i, 16 - i, 255, 0);
- do_test_limit (0, 0, 15 - i, 16 - i, 127, 0);
- do_test_limit (0, 0, 15 - i, 16 - i, 127, 1);
- do_test_limit (0, 0, 15 - i, 16 - i, 127, -1);
- do_test_limit (0, 0, 15 - i, 16 - i, 255, 0);
- do_test_limit (0, 0, 15 - i, 16 - i, 255, 1);
- do_test_limit (0, 0, 15 - i, 16 - i, 255, -1);
+ do_test_limit (0, 0, 17 - i, 16 - i, MIDCHAR, 0);
+ do_test_limit (0, 0, 17 - i, 16 - i, LARGECHAR, 0);
+ do_test_limit (0, 0, 15 - i, 16 - i, MIDCHAR, 0);
+ do_test_limit (0, 0, 15 - i, 16 - i, MIDCHAR, 1);
+ do_test_limit (0, 0, 15 - i, 16 - i, MIDCHAR, -1);
+ do_test_limit (0, 0, 15 - i, 16 - i, LARGECHAR, 0);
+ do_test_limit (0, 0, 15 - i, 16 - i, LARGECHAR, 1);
+ do_test_limit (0, 0, 15 - i, 16 - i, LARGECHAR, -1);
}
do_random_tests ();