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>
This commit is contained in:
Sunil K Pandey 2021-05-31 10:44:46 -07:00
parent 466c1ea15f
commit 642213e043

View File

@ -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 ();