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

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

index 4e374a59132e1795a4cb6e014997378094031c9b..345716dcb9aab9ce580c0404ff1ae20de8125c98 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2024-06-30  Bruno Haible  <bruno@clisp.org>
 
+       vfzprintf-gnu: Add tests.
+       * tests/test-vfzprintf-gnu.c: New file, based on
+       tests/test-vfprintf-gnu.c.
+       * tests/test-vfzprintf-gnu.sh: New file, based on
+       tests/test-vfprintf-gnu.sh.
+       * tests/test-fprintf-gnu.h: Update title.
+       * modules/vfzprintf-gnu-tests: New file.
+
        vfzprintf-gnu: New module.
        * modules/vfzprintf-gnu: New file.
 
diff --git a/modules/vfzprintf-gnu-tests b/modules/vfzprintf-gnu-tests
new file mode 100644 (file)
index 0000000..64d217b
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-vfzprintf-gnu.sh
+tests/test-vfzprintf-gnu.c
+tests/test-fprintf-gnu.h
+tests/test-printf-gnu.output
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vfzprintf-gnu.sh
+check_PROGRAMS += test-vfzprintf-gnu
index ce6dc395571682a922c272dc23101b964297152e..6c8c3b9f01a5598a2d0bba0a43f63925ff40e6e5 100644 (file)
@@ -1,4 +1,4 @@
-/* Test of POSIX and GNU compatible [v]fprintf() and vd[z]printf() functions.
+/* Test of POSIX and GNU 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-gnu.c b/tests/test-vfzprintf-gnu.c
new file mode 100644 (file)
index 0000000..b2ede1f
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of POSIX and GNU 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 <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-fprintf-gnu.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-gnu.sh b/tests/test-vfzprintf-gnu.sh
new file mode 100755 (executable)
index 0000000..5c60192
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vfzprintf-gnu.tmp t-vfzprintf-gnu.out"
+${CHECKER} ./test-vfzprintf-gnu${EXEEXT} > t-vfzprintf-gnu.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vfzprintf-gnu.tmp > t-vfzprintf-gnu.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-gnu.output" t-vfzprintf-gnu.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result