xref: /PHP-8.0/ext/zlib/tests/gztell_basic2.phpt (revision c5401854)
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 = "gztell_basic2.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--EXPECT--
26int(0)
27bytes written=7
28tell=7
29bytes written=22
30tell=29
31bytes written=54
32tell=83
33bytes written=17
34tell=100
35bytes written=27
36tell=127
37bytes written=15
38tell=142
39bytes written=1000
40tell=1142
41