summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-05-28 15:07:41 +0000
committerBruno Haible <bruno@clisp.org>2007-05-28 15:07:41 +0000
commitbb9cffd58369d44fb36c7e4f20c73339d3525fd4 (patch)
treee722a866eef42735d5c84f4b378b8c17bb2ea378 /tests
parent223df0ab029324964cdd91232d5ccd0e947863ef (diff)
downloadgnulib-bb9cffd58369d44fb36c7e4f20c73339d3525fd4.tar.gz
Tests for module 'fseek'.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-fseek.c30
-rwxr-xr-xtests/test-fseek.sh5
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-fseek.c b/tests/test-fseek.c
new file mode 100644
index 0000000000..5a0b47a797
--- /dev/null
+++ b/tests/test-fseek.c
@@ -0,0 +1,30 @@
+/* Test of fseek() 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 fseek (stdin, 0, SEEK_CUR) != expected;
+}
diff --git a/tests/test-fseek.sh b/tests/test-fseek.sh
new file mode 100755
index 0000000000..bad6c08dda
--- /dev/null
+++ b/tests/test-fseek.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./test-fseek${EXEEXT} 1 < "$srcdir/test-fseek.sh" || exit 1
+echo hi | ./test-fseek${EXEEXT} || exit 1
+exit 0