>From 3ee8ce232478edbe1b93456285b29340fe2eee3e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 5 Nov 2024 21:12:06 +0100 Subject: [PATCH 20/23] wcsncmp tests: Verify N3322 functionality. * tests/test-wcsncmp.c (main): Add zero-size tests. --- ChangeLog | 5 +++++ tests/test-wcsncmp.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0bb5d71f79..0efaf7854b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-11-05 Bruno Haible + + wcsncmp tests: Verify N3322 functionality. + * tests/test-wcsncmp.c (main): Add zero-size tests. + 2024-11-05 Bruno Haible wcsncat tests: Verify N3322 functionality. diff --git a/tests/test-wcsncmp.c b/tests/test-wcsncmp.c index 6db6c248ef..c1fe103ef4 100644 --- a/tests/test-wcsncmp.c +++ b/tests/test-wcsncmp.c @@ -178,5 +178,19 @@ main (int argc, char *argv[]) } } + int volatile value; + + /* Test zero-length operations on NULL pointers, allowed by + . */ + + value = (wcsncmp (NULL, L"x", 0) == 0); + ASSERT (value); + + value = (wcsncmp (L"x", NULL, 0) == 0); + ASSERT (value); + + value = (wcsncmp (NULL, NULL, 0) == 0); + ASSERT (value); + return test_exit_status; } -- 2.34.1