Annotation of embedaddon/php/ext/zlib/tests/gzseek_variation3.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test function gzseek() by calling it with SEEK_CUR when reading
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded("zlib")) {
! 6: print "skip - ZLIB extension not loaded";
! 7: }
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: $f = dirname(__FILE__)."/004.txt.gz";
! 12: $h = gzopen($f, 'r');
! 13:
! 14: echo "move to the 50th byte\n";
! 15: var_dump(gzseek( $h, 50, SEEK_CUR ) );
! 16: echo "tell=".gztell($h)."\n";
! 17: //read the next 10
! 18: var_dump(gzread($h, 10));
! 19:
! 20: echo "\nmove forward to the 94th byte\n";
! 21: var_dump(gzseek( $h, 34, SEEK_CUR ) );
! 22: echo "tell=".gztell($h)."\n";
! 23: //read the next 10
! 24: var_dump(gzread($h, 10));
! 25:
! 26: echo "\nmove backward to the 77th byte\n";
! 27: var_dump(gzseek( $h, -27, SEEK_CUR ) );
! 28: echo "tell=".gztell($h)."\n";
! 29: //read the next 10
! 30: var_dump(gzread($h, 10));
! 31: gzclose($h);
! 32: ?>
! 33: ===DONE===
! 34: --EXPECT--
! 35: move to the 50th byte
! 36: int(0)
! 37: tell=50
! 38: string(10) " high abov"
! 39:
! 40: move forward to the 94th byte
! 41: int(0)
! 42: tell=94
! 43: string(10) "ze it
! 44: Dest"
! 45:
! 46: move backward to the 77th byte
! 47: int(0)
! 48: tell=77
! 49: string(10) "hat you ca"
! 50: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>