]> Savannah Git Hosting - gnulib.git/commitdiff
zprintf-posix: Add tests.
authorBruno Haible <bruno@clisp.org>
Sun, 30 Jun 2024 20:23:45 +0000 (22:23 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 30 Jun 2024 20:47:58 +0000 (22:47 +0200)
* tests/test-zprintf-posix.c: New file, based on
tests/test-printf-posix.c.
* tests/test-zprintf-posix.sh: New file, based on
tests/test-printf-posix.sh.
* modules/zprintf-posix-tests: New file.

ChangeLog
modules/zprintf-posix-tests [new file with mode: 0644]
tests/test-printf-posix.h
tests/test-zprintf-posix.c [new file with mode: 0644]
tests/test-zprintf-posix.sh [new file with mode: 0755]

index 60c8b29f30bb5d1127ac08ddaef0b5e17d7fd65e..db717643c253c0c24344e6320bd8a6b69f8ff279 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2024-06-30  Bruno Haible  <bruno@clisp.org>
 
+       zprintf-posix: Add tests.
+       * tests/test-zprintf-posix.c: New file, based on
+       tests/test-printf-posix.c.
+       * tests/test-zprintf-posix.sh: New file, based on
+       tests/test-printf-posix.sh.
+       * modules/zprintf-posix-tests: New file.
+
        zprintf-posix: New module.
        * modules/zprintf-posix: New file.
 
diff --git a/modules/zprintf-posix-tests b/modules/zprintf-posix-tests
new file mode 100644 (file)
index 0000000..8c44f35
--- /dev/null
@@ -0,0 +1,16 @@
+Files:
+tests/test-zprintf-posix.sh
+tests/test-zprintf-posix.c
+tests/test-printf-posix.h
+tests/test-printf-posix.output
+tests/infinity.h
+tests/macros.h
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-zprintf-posix.sh
+check_PROGRAMS += test-zprintf-posix
index 60b6cf9c84023d482e8da63ede4380e6e95f0f69..32eed6fab1bc4d5650395aeced381e541e89a4e6 100644 (file)
@@ -1,4 +1,4 @@
-/* Test of POSIX compatible v[z]printf() and printf() functions.
+/* Test of POSIX compatible v[z]printf() and [z]printf() functions.
    Copyright (C) 2007-2024 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/tests/test-zprintf-posix.c b/tests/test-zprintf-posix.c
new file mode 100644 (file)
index 0000000..2eddc7d
--- /dev/null
@@ -0,0 +1,37 @@
+/* Test of POSIX compatible zprintf() function.
+   Copyright (C) 2007-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/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-printf-posix.h"
+
+int
+main (int argc, char *argv[])
+{
+  test_function (zprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-zprintf-posix.sh b/tests/test-zprintf-posix.sh
new file mode 100755 (executable)
index 0000000..38169ad
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-zprintf-posix.tmp t-zprintf-posix.out"
+${CHECKER} ./test-zprintf-posix${EXEEXT} > t-zprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-zprintf-posix.tmp > t-zprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-zprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result