mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Add more tests for memchr
This patch adds tests for len == 0 and tests for positions close to the beginning, which are equivalent to positions close to the end for memchr. * string/test-memrchr.c (test_main): Add tests for len == 0 and tests for positions close to the beginning, which are equivalent to positions close to the end for memchr.
This commit is contained in:
@ -151,15 +151,32 @@ test_main (void)
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
/* Test len == 0. */
|
||||
do_test (i, i, 0, 0);
|
||||
do_test (i, i, 0, 23);
|
||||
|
||||
do_test (0, 16 << i, 2048, 23);
|
||||
do_test (i, 64, 256, 23);
|
||||
do_test (0, 16 << i, 2048, 0);
|
||||
do_test (i, 64, 256, 0);
|
||||
|
||||
do_test (0, i, 256, 23);
|
||||
do_test (0, i, 256, 0);
|
||||
do_test (i, i, 256, 23);
|
||||
do_test (i, i, 256, 0);
|
||||
|
||||
}
|
||||
for (i = 1; i < 32; ++i)
|
||||
{
|
||||
do_test (0, i, i + 1, 23);
|
||||
do_test (0, i, i + 1, 0);
|
||||
do_test (i, i, i + 1, 23);
|
||||
do_test (i, i, i + 1, 0);
|
||||
|
||||
do_test (0, 1, i + 1, 23);
|
||||
do_test (0, 2, i + 1, 0);
|
||||
do_test (i, 1, i + 1, 23);
|
||||
do_test (i, 2, i + 1, 0);
|
||||
}
|
||||
|
||||
do_random_tests ();
|
||||
|
Reference in New Issue
Block a user