1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

fprintf-gnu: Add tests.

* tests/test-fprintf-gnu.sh: New file, based on
tests/test-fprintf-posix.sh.
* tests/test-fprintf-gnu.c: New file, based on
tests/test-fprintf-posix.c.
* modules/fprintf-gnu-tests: New file, based on
modules/fprintf-posix-tests.
This commit is contained in:
Bruno Haible
2023-03-24 11:41:10 +01:00
parent 005377bde6
commit d00bce3996
4 changed files with 75 additions and 0 deletions

View File

@@ -1,5 +1,13 @@
2023-03-24 Bruno Haible <bruno@clisp.org> 2023-03-24 Bruno Haible <bruno@clisp.org>
fprintf-gnu: Add tests.
* tests/test-fprintf-gnu.sh: New file, based on
tests/test-fprintf-posix.sh.
* tests/test-fprintf-gnu.c: New file, based on
tests/test-fprintf-posix.c.
* modules/fprintf-gnu-tests: New file, based on
modules/fprintf-posix-tests.
fprintf-gnu: New module. fprintf-gnu: New module.
* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): New macro, * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_FPRINTF_POSIX. extracted from gl_FUNC_FPRINTF_POSIX.

15
modules/fprintf-gnu-tests Normal file
View File

@@ -0,0 +1,15 @@
Files:
tests/test-fprintf-gnu.sh
tests/test-fprintf-gnu.c
tests/test-fprintf-gnu.h
tests/test-printf-gnu.output
tests/macros.h
Depends-on:
fprintf-posix-tests
configure.ac:
Makefile.am:
TESTS += test-fprintf-gnu.sh
check_PROGRAMS += test-fprintf-gnu

36
tests/test-fprintf-gnu.c Normal file
View File

@@ -0,0 +1,36 @@
/* Test of POSIX and GNU compatible fprintf() function.
Copyright (C) 2007-2023 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"
#include "test-fprintf-gnu.h"
int
main (int argc, char *argv[])
{
test_function (fprintf);
return 0;
}

16
tests/test-fprintf-gnu.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-fprintf-gnu.tmp t-fprintf-gnu.out"
${CHECKER} ./test-fprintf-gnu${EXEEXT} > t-fprintf-gnu.tmp || exit 1
LC_ALL=C tr -d '\r' < t-fprintf-gnu.tmp > t-fprintf-gnu.out || exit 1
: "${DIFF=diff}"
${DIFF} "${srcdir}/test-printf-gnu.output" t-fprintf-gnu.out
result=$?
rm -fr $tmpfiles
exit $result