1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-05-13 15:13:36 +00:00

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.
This commit is contained in:
Bruno Haible
2024-06-30 21:17:03 +02:00
parent 22289bfa95
commit 5d03891d50
5 changed files with 91 additions and 1 deletions

View File

@@ -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.

View File

@@ -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

View 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

View File

@@ -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;
}

16
tests/test-vfzprintf-posix.sh Executable file
View File

@@ -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