xref: /php-src/ext/zlib/tests/001.phpt (revision 74859783)
1--TEST--
2gzdeflate()/gzinflate()
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7$original = str_repeat("hallo php",4096);
8$packed=gzdeflate($original);
9echo strlen($packed)." ".strlen($original)."\n";
10$unpacked=gzinflate($packed);
11if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";
12
13/* with explicit compression level, length */
14$original = str_repeat("hallo php",4096);
15$packed=gzdeflate($original, 9);
16echo strlen($packed)." ".strlen($original)."\n";
17$unpacked=gzinflate($packed, 40000);
18if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";
19
20$original = 'aaaaaaaaaaaaaaa';
21$packed=gzdeflate($original);
22echo strlen($packed)." ".strlen($original)."\n";
23$unpacked=gzinflate($packed);
24if (strcmp($original,$unpacked)==0) echo "Strings are equal";
25?>
26--EXPECT--
27100 36864
28Strings are equal
29100 36864
30Strings are equal
315 15
32Strings are equal
33