diff options
Diffstat (limited to 'string/test-memcmp.c')
-rw-r--r-- | string/test-memcmp.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/string/test-memcmp.c b/string/test-memcmp.c index 02ea9b7..fbda26a 100644 --- a/string/test-memcmp.c +++ b/string/test-memcmp.c @@ -111,11 +111,11 @@ do_test (size_t align1, size_t align2, size_t len, int exp_result) if (len == 0) return; - align1 &= 63; + align1 &= (4096 - CHARBYTES); if (align1 + (len + 1) * CHARBYTES >= page_size) return; - align2 &= 63; + align2 &= (4096 - CHARBYTES); if (align2 + (len + 1) * CHARBYTES >= page_size) return; @@ -487,18 +487,40 @@ test_main (void) printf ("\t%s", impl->name); putchar ('\n'); - for (i = 1; i < 16; ++i) + for (i = 1; i < 32; ++i) { do_test (i * CHARBYTES, i * CHARBYTES, i, 0); do_test (i * CHARBYTES, i * CHARBYTES, i, 1); do_test (i * CHARBYTES, i * CHARBYTES, i, -1); } - for (i = 0; i < 16; ++i) + for (i = 0; i < 32; ++i) { do_test (0, 0, i, 0); do_test (0, 0, i, 1); do_test (0, 0, i, -1); + do_test (4096 - i, 0, i, 0); + do_test (4096 - i, 0, i, 1); + do_test (4096 - i, 0, i, -1); + do_test (4095, 0, i, 0); + do_test (4095, 0, i, 1); + do_test (4095, 0, i, -1); + do_test (4095, 4095, i, 0); + do_test (4095, 4095, i, 1); + do_test (4095, 4095, i, -1); + do_test (4000, 95, i, 0); + do_test (4000, 95, i, 1); + do_test (4000, 95, i, -1); + } + + for (i = 33; i < 385; i += 32) + { + do_test (0, 0, i, 0); + do_test (0, 0, i, 1); + do_test (0, 0, i, -1); + do_test (i, 0, i, 0); + do_test (0, i, i, 1); + do_test (i, i, i, -1); } for (i = 1; i < 10; ++i) @@ -506,13 +528,19 @@ test_main (void) do_test (0, 0, 2 << i, 0); do_test (0, 0, 2 << i, 1); do_test (0, 0, 2 << i, -1); - do_test (0, 0, 16 << i, 0); do_test ((8 - i) * CHARBYTES, (2 * i) * CHARBYTES, 16 << i, 0); + do_test (0, 0, 16 << i, 0); do_test (0, 0, 16 << i, 1); do_test (0, 0, 16 << i, -1); + do_test (i, 0, 2 << i, 0); + do_test (0, i, 2 << i, 1); + do_test (i, i, 2 << i, -1); + do_test (i, 0, 16 << i, 0); + do_test (0, i, 16 << i, 1); + do_test (i, i, 16 << i, -1); } - for (i = 1; i < 8; ++i) + for (i = 1; i < 10; ++i) { do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 0); do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 1); |