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