From: Bruno Haible Date: Sun, 30 Jun 2024 19:55:13 +0000 (+0200) Subject: fzprintf-posix: Add tests. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=bfe629490f63607ef950b5f0342d1b9dcb3bf391;p=gnulib.git fzprintf-posix: Add tests. * tests/test-fzprintf-posix.c: New file, based on tests/test-fprintf-posix.c. * tests/test-fzprintf-posix.sh: New file, based on tests/test-fprintf-posix.sh. * modules/fzprintf-posix-tests: New file. --- diff --git a/ChangeLog b/ChangeLog index 8053aeabdc..a9a983f90a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2024-06-30 Bruno Haible + fzprintf-posix: Add tests. + * tests/test-fzprintf-posix.c: New file, based on + tests/test-fprintf-posix.c. + * tests/test-fzprintf-posix.sh: New file, based on + tests/test-fprintf-posix.sh. + * modules/fzprintf-posix-tests: New file. + fzprintf-posix: New module. * modules/fzprintf-posix: New file. diff --git a/modules/fzprintf-posix-tests b/modules/fzprintf-posix-tests new file mode 100644 index 0000000000..66ace8a498 --- /dev/null +++ b/modules/fzprintf-posix-tests @@ -0,0 +1,16 @@ +Files: +tests/test-fzprintf-posix.sh +tests/test-fzprintf-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-fzprintf-posix.sh +check_PROGRAMS += test-fzprintf-posix diff --git a/tests/test-fzprintf-posix.c b/tests/test-fzprintf-posix.c new file mode 100644 index 0000000000..243472b377 --- /dev/null +++ b/tests/test-fzprintf-posix.c @@ -0,0 +1,37 @@ +/* Test of POSIX 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-posix.h" + +int +main (int argc, char *argv[]) +{ + test_function (fzprintf); + return test_exit_status; +} diff --git a/tests/test-fzprintf-posix.sh b/tests/test-fzprintf-posix.sh new file mode 100755 index 0000000000..8ab0e19667 --- /dev/null +++ b/tests/test-fzprintf-posix.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +tmpfiles="" +trap 'rm -fr $tmpfiles' HUP INT QUIT TERM + +tmpfiles="$tmpfiles t-fzprintf-posix.tmp t-fzprintf-posix.out" +${CHECKER} ./test-fzprintf-posix${EXEEXT} > t-fzprintf-posix.tmp || exit 1 +LC_ALL=C tr -d '\r' < t-fzprintf-posix.tmp > t-fzprintf-posix.out || exit 1 + +: "${DIFF=diff}" +${DIFF} "${srcdir}/test-printf-posix.output" t-fzprintf-posix.out +result=$? + +rm -fr $tmpfiles + +exit $result