]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add more tests for memchr
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 8 Jun 2017 16:55:48 +0000 (09:55 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 8 Jun 2017 16:56:01 +0000 (09:56 -0700)
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.

ChangeLog
string/test-memrchr.c

index bbc21abb6c307ead499ae1cc644456011e1dada7..bd530a8d87c1f7d3f860c8515309b834b24b298e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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.
+
 2017-06-07  H.J. Lu  <hongjiu.lu@intel.com>
 
        * sysdeps/x86_64/multiarch/ifunc-impl-list.c: Update
index bfc9920dcce0164130aa4641beb8063e52095a3b..15483f5cb5c4b8c20d5d056c2bdd2808fdb60941 100644 (file)
@@ -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 ();