aboutsummaryrefslogtreecommitdiff
path: root/string
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-06-08 09:55:48 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-06-08 09:56:01 -0700
commit4615f5aefeaa45345484a9ce8e3d0ea977c80d80 (patch)
tree96bae1ffe8f08c86f2a43b1293650ed9cc11cba0 /string
parent5e1122827a9f9751922b25c332f8f0272de60719 (diff)
downloadglibc-4615f5aefeaa45345484a9ce8e3d0ea977c80d80.zip
glibc-4615f5aefeaa45345484a9ce8e3d0ea977c80d80.tar.gz
glibc-4615f5aefeaa45345484a9ce8e3d0ea977c80d80.tar.bz2
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.
Diffstat (limited to 'string')
-rw-r--r--string/test-memrchr.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/string/test-memrchr.c b/string/test-memrchr.c
index bfc9920..15483f5 100644
--- a/string/test-memrchr.c
+++ b/string/test-memrchr.c
@@ -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 ();