[PATCH v2] Improve test coverage of strnlen function
Sunil K Pandey
skpgkp2@gmail.com
Wed Jun 2 21:00:22 GMT 2021
This patch covers the following condition:
Strings start with different alignments and end with length less than or
equal to 512 byte.
---
string/test-strnlen.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/string/test-strnlen.c b/string/test-strnlen.c
index d70faa26ab..fc2519614f 100644
--- a/string/test-strnlen.c
+++ b/string/test-strnlen.c
@@ -271,6 +271,15 @@ test_main (void)
do_test (1, 1 << i, 5000, BIG_CHAR);
}
+ size_t pagesize = getpagesize () / sizeof (CHAR);
+
+ for (i = 0; i <= 127; i++)
+ for (size_t length = i; length <= 512; length++)
+ {
+ do_test (i, length, 512, BIG_CHAR);
+ do_test (pagesize - i, length, 512, BIG_CHAR);
+ }
+
do_random_tests ();
do_page_tests ();
do_page_2_tests ();
--
2.31.1
More information about the Libc-alpha
mailing list