From: Bruno Haible Date: Sun, 30 Jun 2024 20:23:45 +0000 (+0200) Subject: zprintf-posix: Add tests. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5c24277e4888e93d8be10cf12e8055bd72895caa;p=gnulib.git zprintf-posix: Add tests. * tests/test-zprintf-posix.c: New file, based on tests/test-printf-posix.c. * tests/test-zprintf-posix.sh: New file, based on tests/test-printf-posix.sh. * modules/zprintf-posix-tests: New file. --- diff --git a/ChangeLog b/ChangeLog index 60c8b29f30..db717643c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2024-06-30 Bruno Haible + zprintf-posix: Add tests. + * tests/test-zprintf-posix.c: New file, based on + tests/test-printf-posix.c. + * tests/test-zprintf-posix.sh: New file, based on + tests/test-printf-posix.sh. + * modules/zprintf-posix-tests: New file. + zprintf-posix: New module. * modules/zprintf-posix: New file. diff --git a/modules/zprintf-posix-tests b/modules/zprintf-posix-tests new file mode 100644 index 0000000000..8c44f35c0f --- /dev/null +++ b/modules/zprintf-posix-tests @@ -0,0 +1,16 @@ +Files: +tests/test-zprintf-posix.sh +tests/test-zprintf-posix.c +tests/test-printf-posix.h +tests/test-printf-posix.output +tests/infinity.h +tests/macros.h + +Depends-on: +stdint + +configure.ac: + +Makefile.am: +TESTS += test-zprintf-posix.sh +check_PROGRAMS += test-zprintf-posix diff --git a/tests/test-printf-posix.h b/tests/test-printf-posix.h index 60b6cf9c84..32eed6fab1 100644 --- a/tests/test-printf-posix.h +++ b/tests/test-printf-posix.h @@ -1,4 +1,4 @@ -/* Test of POSIX compatible v[z]printf() and printf() functions. +/* Test of POSIX compatible v[z]printf() and [z]printf() functions. Copyright (C) 2007-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/tests/test-zprintf-posix.c b/tests/test-zprintf-posix.c new file mode 100644 index 0000000000..2eddc7d135 --- /dev/null +++ b/tests/test-zprintf-posix.c @@ -0,0 +1,37 @@ +/* Test of POSIX compatible zprintf() 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-printf-posix.h" + +int +main (int argc, char *argv[]) +{ + test_function (zprintf); + return test_exit_status; +} diff --git a/tests/test-zprintf-posix.sh b/tests/test-zprintf-posix.sh new file mode 100755 index 0000000000..38169ad4f2 --- /dev/null +++ b/tests/test-zprintf-posix.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +tmpfiles="" +trap 'rm -fr $tmpfiles' HUP INT QUIT TERM + +tmpfiles="$tmpfiles t-zprintf-posix.tmp t-zprintf-posix.out" +${CHECKER} ./test-zprintf-posix${EXEEXT} > t-zprintf-posix.tmp || exit 1 +LC_ALL=C tr -d '\r' < t-zprintf-posix.tmp > t-zprintf-posix.out || exit 1 + +: "${DIFF=diff}" +${DIFF} "${srcdir}/test-printf-posix.output" t-zprintf-posix.out +result=$? + +rm -fr $tmpfiles + +exit $result