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

zprintf-gnu: Add tests.

* tests/test-zprintf-gnu.c: New file, based on tests/test-printf-gnu.c.
* tests/test-zprintf-gnu.sh: New file, based on
tests/test-printf-gnu.sh.
* modules/zprintf-gnu-tests: New file.
This commit is contained in:
Bruno Haible
2024-06-30 23:10:41 +02:00
parent 20b4e573b2
commit 7ef85f40fd
4 changed files with 72 additions and 0 deletions

View File

@@ -1,5 +1,11 @@
2024-06-30 Bruno Haible <bruno@clisp.org>
zprintf-gnu: Add tests.
* tests/test-zprintf-gnu.c: New file, based on tests/test-printf-gnu.c.
* tests/test-zprintf-gnu.sh: New file, based on
tests/test-printf-gnu.sh.
* modules/zprintf-gnu-tests: New file.
zprintf-gnu: New module.
* modules/zprintf-gnu: New file.

14
modules/zprintf-gnu-tests Normal file
View File

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

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

@@ -0,0 +1,36 @@
/* Test of POSIX and GNU 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 <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#include <config.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include "macros.h"
#define RETTYPE off64_t
#include "test-printf-gnu.h"
int
main (int argc, char *argv[])
{
test_function (zprintf);
return test_exit_status;
}

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

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