]> Savannah Git Hosting - gnulib.git/commitdiff
qsort tests: Verify N3322 functionality.
authorBruno Haible <bruno@clisp.org>
Tue, 5 Nov 2024 20:10:02 +0000 (21:10 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 5 Nov 2024 21:19:15 +0000 (22:19 +0100)
* 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
doc/posix-functions/qsort.texi
modules/qsort [new file with mode: 0644]
modules/qsort-tests [new file with mode: 0644]
tests/test-qsort.c [new file with mode: 0644]

index 55cbc80e0fe0d1af04b58f8f62cc60d8bca22d30..59575ece66f9e70d8e06adb1cf8731f7ca8ef5b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-11-05  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        bsearch tests: Verify N3322 functionality.
index 5d6523e528d52636b1aad350ba79ddd59438b7c3..87491b7eeb54a415451357271f8a7dd366effa0e 100644 (file)
@@ -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 (file)
index 0000000..8fef487
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Sorting an array.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/qsort-tests b/modules/qsort-tests
new file mode 100644 (file)
index 0000000..6d31f6b
--- /dev/null
@@ -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 (file)
index 0000000..9ab39b1
--- /dev/null
@@ -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 <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+static int
+cmp (const void *a, const void *b)
+{
+  return 0;
+}
+
+int
+main (void)
+{
+  /* Test zero-length operations on NULL pointers, allowed by
+     <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
+
+  qsort (NULL, 0, 1, cmp);
+
+  return 0;
+}