2024-06-30 Bruno Haible <bruno@clisp.org>
+ vdzprintf-gnu: Add tests.
+ * tests/test-fprintf-gnu.h (test_function): Use RETTYPE instead of
+ 'int'.
+ * tests/test-fprintf-gnu.c (RETTYPE): New macro.
+ * tests/test-vdprintf-gnu.c (RETTYPE): New macro.
+ * tests/test-vfprintf-gnu.c (RETTYPE): New macro.
+ * tests/test-vdzprintf-gnu.c: New file, based on
+ tests/test-vdzprintf-posix.c.
+ * tests/test-vdzprintf-gnu.sh: New file, based on
+ tests/test-vdzprintf-posix.sh.
+ * modules/vdzprintf-gnu-tests: New file.
+
vdzprintf-gnu: New module.
* modules/vdzprintf-gnu: New file.
--- /dev/null
+Files:
+tests/test-vdzprintf-gnu.sh
+tests/test-vdzprintf-gnu.c
+tests/test-fprintf-gnu.h
+tests/test-printf-gnu.output
+tests/infinity.h
+tests/macros.h
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vdzprintf-gnu.sh
+check_PROGRAMS += test-vdzprintf-gnu
#include "macros.h"
+#define RETTYPE int
#include "test-fprintf-gnu.h"
int
-/* Test of POSIX and GNU compatible [v]fprintf() and vdprintf() functions.
+/* Test of POSIX and GNU compatible [v]fprintf() 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
/* Written by Bruno Haible <bruno@clisp.org>, 2023. */
static void
-test_function (int (*my_fprintf) (FILE *, const char *, ...))
+test_function (RETTYPE (*my_fprintf) (FILE *, const char *, ...))
{
/* Here we don't test output that may be platform dependent.
The bulk of the tests is done as part of the 'vasnprintf-posix' module. */
#include "macros.h"
+#define RETTYPE int
#include "test-fprintf-gnu.h"
static int
--- /dev/null
+/* Test of POSIX and GNU compatible vdzprintf() 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>, 2009. */
+
+#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-gnu.h"
+
+static off64_t
+my_fzprintf (FILE *fp, const char *format, ...)
+{
+ va_list args;
+ off64_t ret;
+
+ va_start (args, format);
+ ret = vdzprintf (fileno (fp), format, args);
+ va_end (args);
+ return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+ test_function (my_fzprintf);
+ return test_exit_status;
+}
--- /dev/null
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vdzprintf-gnu.tmp t-vdzprintf-gnu.out"
+${CHECKER} ./test-vdzprintf-gnu${EXEEXT} > t-vdzprintf-gnu.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vdzprintf-gnu.tmp > t-vdzprintf-gnu.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-gnu.output" t-vdzprintf-gnu.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
#include "macros.h"
+#define RETTYPE int
#include "test-fprintf-gnu.h"
static int