From d3c9d629b8eadfda54c16879b36b7edfd2f03805 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 5 Nov 2024 21:10:02 +0100 Subject: [PATCH] qsort tests: Verify N3322 functionality. * modules/qsort: New file. * doc/posix-functions/qsort.texi: Mention the new module. * tests/test-qsort.c: New file. * modules/qsort-tests: New file. --- ChangeLog | 8 ++++++++ doc/posix-functions/qsort.texi | 3 ++- modules/qsort | 25 +++++++++++++++++++++++ modules/qsort-tests | 10 +++++++++ tests/test-qsort.c | 37 ++++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 modules/qsort create mode 100644 modules/qsort-tests create mode 100644 tests/test-qsort.c diff --git a/ChangeLog b/ChangeLog index 55cbc80e0f..59575ece66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-11-05 Bruno Haible + + qsort tests: Verify N3322 functionality. + * modules/qsort: New file. + * doc/posix-functions/qsort.texi: Mention the new module. + * tests/test-qsort.c: New file. + * modules/qsort-tests: New file. + 2024-11-05 Bruno Haible bsearch tests: Verify N3322 functionality. diff --git a/doc/posix-functions/qsort.texi b/doc/posix-functions/qsort.texi index 5d6523e528..87491b7eeb 100644 --- a/doc/posix-functions/qsort.texi +++ b/doc/posix-functions/qsort.texi @@ -4,7 +4,8 @@ POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/qsort.html} -Gnulib module: --- +Gnulib module: qsort +@mindex qsort Portability problems fixed by Gnulib: @itemize diff --git a/modules/qsort b/modules/qsort new file mode 100644 index 0000000000..8fef487959 --- /dev/null +++ b/modules/qsort @@ -0,0 +1,25 @@ +Description: +Sorting an array. + +Status: +obsolete + +Notice: +This module is obsolete. + +Files: + +Depends-on: + +configure.ac: + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +all diff --git a/modules/qsort-tests b/modules/qsort-tests new file mode 100644 index 0000000000..6d31f6b09e --- /dev/null +++ b/modules/qsort-tests @@ -0,0 +1,10 @@ +Files: +tests/test-qsort.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-qsort +check_PROGRAMS += test-qsort diff --git a/tests/test-qsort.c b/tests/test-qsort.c new file mode 100644 index 0000000000..9ab39b13e4 --- /dev/null +++ b/tests/test-qsort.c @@ -0,0 +1,37 @@ +/* Test of qsort() function. + Copyright (C) 2024 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +static int +cmp (const void *a, const void *b) +{ + return 0; +} + +int +main (void) +{ + /* Test zero-length operations on NULL pointers, allowed by + . */ + + qsort (NULL, 0, 1, cmp); + + return 0; +} -- 2.39.5