summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/gzseek_variation3.phpt
diff options
context:
space:
mode:
authorDave Kelsey <dkelsey@php.net>2009-01-19 14:03:08 +0000
committerDave Kelsey <dkelsey@php.net>2009-01-19 14:03:08 +0000
commit8f9ec4238fa879ab7bc4adb5c42a222b929c3b60 (patch)
treea5c6e17e512963f68d6933ceebca218b55a26487 /ext/zlib/tests/gzseek_variation3.phpt
parent357ed77aeaeaf45885d372b061b67110fe04dc76 (diff)
downloadphp-git-8f9ec4238fa879ab7bc4adb5c42a222b929c3b60.tar.gz
new tests for zlib extension, tested on windows, linux and linux64
Diffstat (limited to 'ext/zlib/tests/gzseek_variation3.phpt')
-rw-r--r--ext/zlib/tests/gzseek_variation3.phpt50
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/zlib/tests/gzseek_variation3.phpt b/ext/zlib/tests/gzseek_variation3.phpt
new file mode 100644
index 0000000000..dee7c1302a
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation3.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test function gzseek() by calling it with SEEK_CUR when reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+
+echo "move to the 50th byte\n";
+var_dump(gzseek( $h, 50, SEEK_CUR ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove forward to the 94th byte\n";
+var_dump(gzseek( $h, 34, SEEK_CUR ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove backward to the 77th byte\n";
+var_dump(gzseek( $h, -27, SEEK_CUR ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+move to the 50th byte
+int(0)
+tell=50
+string(10) " high abov"
+
+move forward to the 94th byte
+int(0)
+tell=94
+string(10) "ze it
+Dest"
+
+move backward to the 77th byte
+int(0)
+tell=77
+string(10) "hat you ca"
+===DONE=== \ No newline at end of file