- remove http_compress() and http_uncompress() (deflate/inflate ambiguity)
[m6w6/ext-http] / tests / encodings.phpt
1 --TEST--
2 encodings
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 skipif(!function_exists('http_gzencode'), 'need zlib');
7 ?>
8 --FILE--
9 <?php
10 echo "-TEST\n";
11
12 set_time_limit(0);
13 error_reporting(E_ALL);
14
15 $s = '';
16
17 srand(time());
18 for ($i = 0; $i < 1000000; $i++) {
19 $s .= chr(rand(0,255));
20 }
21
22 var_dump($s == http_gzdecode(http_gzencode($s)));
23 var_dump($s == http_inflate(http_deflate($s)));
24 var_dump($s == http_inflate(http_deflate($s, -1, true)));
25
26 if (extension_loaded('zlib')) {
27
28 $s = "A simple test string, which won't blow up ext/zlib.\n";
29
30 ($s == http_gzdecode(gzencode($s))) or print "GZIP Failed\n";
31 ($s == http_inflate(gzdeflate($s))) or print "DEFLATE Failed\n";
32 ($s == http_inflate(gzcompress($s))) or print "COMPRESS Failed\n";
33
34 ($s == gzinflate(http_deflate($s))) or print "INFLATE Failed\n";
35 ($s == gzuncompress(http_deflate($s, -1, true))) or print "UNCOMPRESS Failed\n";
36 }
37
38 echo "Done\n";
39 ?>
40 --EXPECTF--
41 %sTEST
42 bool(true)
43 bool(true)
44 bool(true)
45 Done