mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
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.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,5 +1,17 @@
|
|||||||
2024-06-30 Bruno Haible <bruno@clisp.org>
|
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.
|
vdzprintf-gnu: New module.
|
||||||
* modules/vdzprintf-gnu: New file.
|
* modules/vdzprintf-gnu: New file.
|
||||||
|
|
||||||
|
16
modules/vdzprintf-gnu-tests
Normal file
16
modules/vdzprintf-gnu-tests
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
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
|
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
|
#define RETTYPE int
|
||||||
#include "test-fprintf-gnu.h"
|
#include "test-fprintf-gnu.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* 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.
|
Copyright (C) 2007-2024 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
/* Written by Bruno Haible <bruno@clisp.org>, 2023. */
|
/* Written by Bruno Haible <bruno@clisp.org>, 2023. */
|
||||||
|
|
||||||
static void
|
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.
|
/* 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. */
|
The bulk of the tests is done as part of the 'vasnprintf-posix' module. */
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
|
#define RETTYPE int
|
||||||
#include "test-fprintf-gnu.h"
|
#include "test-fprintf-gnu.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
50
tests/test-vdzprintf-gnu.c
Normal file
50
tests/test-vdzprintf-gnu.c
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/* 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;
|
||||||
|
}
|
16
tests/test-vdzprintf-gnu.sh
Executable file
16
tests/test-vdzprintf-gnu.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/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
|
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
|
#define RETTYPE int
|
||||||
#include "test-fprintf-gnu.h"
|
#include "test-fprintf-gnu.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Reference in New Issue
Block a user