From 606d7377b1b7e2bf1364770a4f9f1a685c6e7269 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 30 Jun 2024 22:56:15 +0200 Subject: [PATCH] fzprintf-gnu: Add tests. * tests/test-fzprintf-gnu.c: New file, based on tests/test-fprintf-gnu.c. * tests/test-fzprintf-gnu.sh: New file, based on tests/test-fprintf-gnu.sh. * modules/fzprintf-gnu-tests: New file. --- ChangeLog | 7 +++++++ modules/fzprintf-gnu-tests | 14 ++++++++++++++ tests/test-fzprintf-gnu.c | 37 +++++++++++++++++++++++++++++++++++++ tests/test-fzprintf-gnu.sh | 16 ++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 modules/fzprintf-gnu-tests create mode 100644 tests/test-fzprintf-gnu.c create mode 100755 tests/test-fzprintf-gnu.sh diff --git a/ChangeLog b/ChangeLog index e2efc8327a..0d1337af30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2024-06-30 Bruno Haible + fzprintf-gnu: Add tests. + * tests/test-fzprintf-gnu.c: New file, based on + tests/test-fprintf-gnu.c. + * tests/test-fzprintf-gnu.sh: New file, based on + tests/test-fprintf-gnu.sh. + * modules/fzprintf-gnu-tests: New file. + fzprintf-gnu: New module. * modules/fzprintf-gnu: New file. diff --git a/modules/fzprintf-gnu-tests b/modules/fzprintf-gnu-tests new file mode 100644 index 0000000000..8ab6bdcb8d --- /dev/null +++ b/modules/fzprintf-gnu-tests @@ -0,0 +1,14 @@ +Files: +tests/test-fzprintf-gnu.sh +tests/test-fzprintf-gnu.c +tests/test-fprintf-gnu.h +tests/test-printf-gnu.output +tests/macros.h + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-fzprintf-gnu.sh +check_PROGRAMS += test-fzprintf-gnu diff --git a/tests/test-fzprintf-gnu.c b/tests/test-fzprintf-gnu.c new file mode 100644 index 0000000000..5acd8dd78e --- /dev/null +++ b/tests/test-fzprintf-gnu.c @@ -0,0 +1,37 @@ +/* Test of POSIX and GNU compatible fzprintf() 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 . */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#include +#include +#include + +#include "macros.h" + +#define RETTYPE off64_t +#include "test-fprintf-gnu.h" + +int +main (int argc, char *argv[]) +{ + test_function (fzprintf); + return test_exit_status; +} diff --git a/tests/test-fzprintf-gnu.sh b/tests/test-fzprintf-gnu.sh new file mode 100755 index 0000000000..668ecdc29a --- /dev/null +++ b/tests/test-fzprintf-gnu.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +tmpfiles="" +trap 'rm -fr $tmpfiles' HUP INT QUIT TERM + +tmpfiles="$tmpfiles t-fzprintf-gnu.tmp t-fzprintf-gnu.out" +${CHECKER} ./test-fzprintf-gnu${EXEEXT} > t-fzprintf-gnu.tmp || exit 1 +LC_ALL=C tr -d '\r' < t-fzprintf-gnu.tmp > t-fzprintf-gnu.out || exit 1 + +: "${DIFF=diff}" +${DIFF} "${srcdir}/test-printf-gnu.output" t-fzprintf-gnu.out +result=$? + +rm -fr $tmpfiles + +exit $result -- 2.39.5