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