summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-05-28 15:16:56 +0000
committerBruno Haible <bruno@clisp.org>2007-05-28 15:16:56 +0000
commit2e7980e7a83a290bfaf0638bd95a9cbfeec0f67d (patch)
treed26ee1e4031d1aac1af1f8080056a66fd74a9006 /tests
parentcf0e9950204657e10ec322126130fb35b1d99925 (diff)
downloadgnulib-2e7980e7a83a290bfaf0638bd95a9cbfeec0f67d.tar.gz
Tests for module 'ftell'.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-ftell.c30
-rwxr-xr-xtests/test-ftell.sh5
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-ftell.c b/tests/test-ftell.c
new file mode 100644
index 0000000000..b42fbce858
--- /dev/null
+++ b/tests/test-ftell.c
@@ -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;
+}
diff --git a/tests/test-ftell.sh b/tests/test-ftell.sh
new file mode 100755
index 0000000000..bf55d2e997
--- /dev/null
+++ b/tests/test-ftell.sh
@@ -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