changeset 8889:4f3e993d4155

Tests for module 'ftell'.
author Bruno Haible <bruno@clisp.org>
date Mon, 28 May 2007 15:16:56 +0000
parents 6f9096a04fe8
children 576d3e4f31c2
files ChangeLog modules/ftell-tests tests/test-ftell.c tests/test-ftell.sh
diffstat 4 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon May 28 15:13:36 2007 +0000
+++ b/ChangeLog	Mon May 28 15:16:56 2007 +0000
@@ -1,5 +1,9 @@
 2007-05-28  Bruno Haible  <bruno@clisp.org>
 
+	* modules/ftell-tests: New file.
+	* tests/test-ftell.c: New file, based on tests/test-ftello.c.
+	* tests/test-ftell.sh: New file, based on tests/test-ftello.sh.
+
 	* lib/ftell.c: New file.
 	* modules/ftell: New file.
 	* m4/ftell.m4: New file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/ftell-tests	Mon May 28 15:16:56 2007 +0000
@@ -0,0 +1,13 @@
+Files:
+tests/test-ftell.c
+tests/test-ftell.sh
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-ftell.sh
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
+check_PROGRAMS += test-ftell
+EXTRA_DIST += test-ftell.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-ftell.c	Mon May 28 15:16:56 2007 +0000
@@ -0,0 +1,30 @@
+/* Test of ftell() 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.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+int
+main (int argc, char **argv)
+{
+  /* Assume stdin is seekable iff argc > 1.  */
+  int expected = argc > 1 ? 0 : -1;
+  return ftell (stdin) != expected;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-ftell.sh	Mon May 28 15:16:56 2007 +0000
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./test-ftell${EXEEXT} 1 < "$srcdir/test-ftell.sh" || exit 1
+echo hi | ./test-ftell${EXEEXT} || exit 1
+exit 0