From: Bruno Haible Date: Fri, 9 Mar 2007 03:00:45 +0000 (+0000) Subject: Tests for module 'fprintf-posix'. X-Git-Tag: cvs-readonly~823 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=f26a01b9cacd929764b711a9fd94a9824a8f9caa;p=gnulib.git Tests for module 'fprintf-posix'. --- diff --git a/ChangeLog b/ChangeLog index 8ed30e0e7..b3ed20e37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-03-08 Bruno Haible + * modules/fprintf-posix-tests: New file. + * tests/test-fprintf-posix.sh: New file. + * tests/test-fprintf-posix.c: New file. + * modules/fprintf-posix: New file. * lib/fprintf.c: New file. * m4/fprintf-posix.m4: New file. diff --git a/modules/fprintf-posix-tests b/modules/fprintf-posix-tests new file mode 100644 index 000000000..4e45cba9e --- /dev/null +++ b/modules/fprintf-posix-tests @@ -0,0 +1,16 @@ +Files: +tests/test-fprintf-posix.sh +tests/test-fprintf-posix.c +tests/test-fprintf-posix.h +tests/test-fprintf-posix.out + +Depends-on: +stdint + +configure.ac: + +Makefile.am: +TESTS += test-fprintf-posix.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' +check_PROGRAMS += test-fprintf-posix +EXTRA_DIST += test-fprintf-posix.sh test-fprintf-posix.h test-fprintf-posix.out diff --git a/tests/test-fprintf-posix.c b/tests/test-fprintf-posix.c new file mode 100644 index 000000000..00402f6db --- /dev/null +++ b/tests/test-fprintf-posix.c @@ -0,0 +1,41 @@ +/* Test of POSIX compatible fprintf() function. + Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include +#include +#include +#include +#include + +#define ASSERT(expr) if (!(expr)) abort (); + +#include "test-fprintf-posix.h" + +int +main (int argc, char *argv[]) +{ + test_function (fprintf); + return 0; +} diff --git a/tests/test-fprintf-posix.sh b/tests/test-fprintf-posix.sh new file mode 100755 index 000000000..c21cc4d8e --- /dev/null +++ b/tests/test-fprintf-posix.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles t-fprintf-posix.tmp" +./test-fprintf-posix${EXEEXT} > t-fprintf-posix.tmp || exit 1 + +: ${DIFF=diff} +${DIFF} "${srcdir}/test-fprintf-posix.out" t-fprintf-posix.tmp +result=$? + +rm -fr $tmpfiles + +exit $result