public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Improve test coverage of strnlen function
@ 2021-06-03 18:19 Sunil Pandey
  0 siblings, 0 replies; only message in thread
From: Sunil Pandey @ 2021-06-03 18:19 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=642213e043040b2e3b5aad936986195491107e34

commit 642213e043040b2e3b5aad936986195491107e34
Author: Sunil K Pandey <skpgkp2@gmail.com>
Date:   Mon May 31 10:44:46 2021 -0700

    Improve test coverage of strnlen function
    
    This patch covers the following condition:
    
    Strings start with different alignments and end with length less than or
    equal to 512 byte.
    
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 string/test-strnlen.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/string/test-strnlen.c b/string/test-strnlen.c
index d70faa26ab..920f58e97b 100644
--- a/string/test-strnlen.c
+++ b/string/test-strnlen.c
@@ -230,7 +230,7 @@ do_page_2_tests (void)
 int
 test_main (void)
 {
-  size_t i;
+  size_t i, length, char_per_page;
 
   test_init ();
 
@@ -271,6 +271,15 @@ test_main (void)
       do_test (1, 1 << i, 5000, BIG_CHAR);
     }
 
+  char_per_page = getpagesize () / sizeof (CHAR);
+
+  for (i = 0; i <= 127; i++)
+    for (length = i; length <= 512; length++)
+      {
+	do_test (i, length, 512, BIG_CHAR);
+	do_test (char_per_page - i, length, 512, BIG_CHAR);
+      }
+
   do_random_tests ();
   do_page_tests ();
   do_page_2_tests ();


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-03 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 18:19 [glibc] Improve test coverage of strnlen function Sunil Pandey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).