gztell_basic2.phpt 647 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Test function gztell() by calling it with its expected arguments when writing
  3. --EXTENSIONS--
  4. zlib
  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. var_dump(gztell($h));
  12. foreach ($sizes as $size) {
  13. echo "bytes written=".gzwrite($h, str_repeat('1', $size))."\n";
  14. echo "tell=".gztell($h)."\n";
  15. }
  16. gzclose($h);
  17. unlink($f);
  18. ?>
  19. --EXPECT--
  20. int(0)
  21. bytes written=7
  22. tell=7
  23. bytes written=22
  24. tell=29
  25. bytes written=54
  26. tell=83
  27. bytes written=17
  28. tell=100
  29. bytes written=27
  30. tell=127
  31. bytes written=15
  32. tell=142
  33. bytes written=1000
  34. tell=1142