]> Savannah Git Hosting - gnulib.git/commitdiff
vfzprintf-posix: Add tests.
authorBruno Haible <bruno@clisp.org>
Sun, 30 Jun 2024 19:17:03 +0000 (21:17 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 30 Jun 2024 20:33:24 +0000 (22:33 +0200)
* tests/test-vfzprintf-posix.c: New file, based on
tests/test-vfprintf-posix.c.
* tests/test-vfzprintf-posix.sh: New file, based on
tests/test-vfprintf-posix.sh.
* tests/test-fprintf-posix.h: Update title.
* modules/vfzprintf-posix-tests: New file.

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

index 981b2734e7cfb5b2859b77485d1170fc189a54a2..5cc7ae4ac6f759bfab9b73960ed5b6183dc71668 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2024-06-30  Bruno Haible  <bruno@clisp.org>
 
+       vfzprintf-posix: Add tests.
+       * tests/test-vfzprintf-posix.c: New file, based on
+       tests/test-vfprintf-posix.c.
+       * tests/test-vfzprintf-posix.sh: New file, based on
+       tests/test-vfprintf-posix.sh.
+       * tests/test-fprintf-posix.h: Update title.
+       * modules/vfzprintf-posix-tests: New file.
+
        vfzprintf-posix: New module.
        * modules/vfzprintf-posix: New file.
 
diff --git a/modules/vfzprintf-posix-tests b/modules/vfzprintf-posix-tests
new file mode 100644 (file)
index 0000000..99902f9
--- /dev/null
@@ -0,0 +1,16 @@
+Files:
+tests/test-vfzprintf-posix.sh
+tests/test-vfzprintf-posix.c
+tests/test-fprintf-posix.h
+tests/test-printf-posix.output
+tests/infinity.h
+tests/macros.h
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vfzprintf-posix.sh
+check_PROGRAMS += test-vfzprintf-posix
index eac279ddb83f0f66feed3d9cd9f90c4eb1633ba7..2242d2af49e5e9fb7c23aab5ed94562409a58d52 100644 (file)
@@ -1,4 +1,4 @@
-/* Test of POSIX compatible [v]fprintf() and vd[z]printf() functions.
+/* Test of POSIX compatible [v]f[z]printf() and vd[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-vfzprintf-posix.c b/tests/test-vfzprintf-posix.c
new file mode 100644 (file)
index 0000000..219d0b9
--- /dev/null
@@ -0,0 +1,50 @@
+/* Test of POSIX compatible vfzprintf() 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 <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-fprintf-posix.h"
+
+static off64_t
+my_fzprintf (FILE *fp, const char *format, ...)
+{
+  va_list args;
+  off64_t ret;
+
+  va_start (args, format);
+  ret = vfzprintf (fp, format, args);
+  va_end (args);
+  return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_function (my_fzprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-vfzprintf-posix.sh b/tests/test-vfzprintf-posix.sh
new file mode 100755 (executable)
index 0000000..6d28636
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vfzprintf-posix.tmp t-vfzprintf-posix.out"
+${CHECKER} ./test-vfzprintf-posix${EXEEXT} > t-vfzprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vfzprintf-posix.tmp > t-vfzprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-vfzprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result