xref: /php-src/ext/zlib/tests/gztell_basic2.phpt (revision 74859783)
1--TEST--
2Test function gztell() by calling it with its expected arguments when writing
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7$f = "gztell_basic2.txt.gz";
8$h = gzopen($f, 'w');
9$sizes = array(7, 22, 54, 17, 27, 15, 1000);
10// tell should be 7, 29, 83, 100, 127, 142, 1142
11
12var_dump(gztell($h));
13foreach ($sizes as $size) {
14   echo "bytes written=".gzwrite($h, str_repeat('1', $size))."\n";
15   echo "tell=".gztell($h)."\n";
16}
17
18gzclose($h);
19unlink($f);
20?>
21--EXPECT--
22int(0)
23bytes written=7
24tell=7
25bytes written=22
26tell=29
27bytes written=54
28tell=83
29bytes written=17
30tell=100
31bytes written=27
32tell=127
33bytes written=15
34tell=142
35bytes written=1000
36tell=1142
37