changeset 8395:e624b373611c

Tests for module 'fprintf-posix'.
author Bruno Haible <bruno@clisp.org>
date Fri, 09 Mar 2007 03:00:45 +0000
parents fbb6e4d5f75b
children ca9d4758592d
files ChangeLog modules/fprintf-posix-tests tests/test-fprintf-posix.c tests/test-fprintf-posix.sh
diffstat 4 files changed, 76 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-03-08  Bruno Haible  <bruno@clisp.org>
 
+	* 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.
new file mode 100644
--- /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
new file mode 100644
--- /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 <bruno@clisp.org>, 2007.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define ASSERT(expr) if (!(expr)) abort ();
+
+#include "test-fprintf-posix.h"
+
+int
+main (int argc, char *argv[])
+{
+  test_function (fprintf);
+  return 0;
+}
new file mode 100755
--- /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