xref: /PHP-8.0/ext/bz2/tests/005.phpt (revision fe0763c8)
1--TEST--
2bzcompress()/bzdecompress() tests
3--SKIPIF--
4<?php if (!extension_loaded("bz2")) print "skip"; ?>
5--FILE--
6<?php
7
8$string = "Life it seems, will fade away
9Drifting further everyday
10Getting lost within myself
11Nothing matters no one else";
12
13var_dump(bzcompress(1,1,1));
14var_dump(bzcompress($string, 100));
15var_dump(bzcompress($string, 100, -1));
16var_dump(bzcompress($string, 100, 1000));
17var_dump(bzcompress($string, -1, 1));
18
19$data = bzcompress($string);
20$data2 = bzcompress($string, 1, 10);
21
22$data3 = $data2;
23$data3[3] = 0;
24
25var_dump(bzdecompress(1,1));
26var_dump(bzdecompress($data3));
27var_dump(bzdecompress($data3,1));
28
29var_dump(bzdecompress($data, 0));
30var_dump(bzdecompress($data, 1));
31var_dump(bzdecompress($data));
32var_dump(bzdecompress($data2));
33
34echo "Done\n";
35?>
36--EXPECTF--
37string(%d) "BZ%a"
38int(-2)
39int(-2)
40int(-2)
41int(-2)
42int(-5)
43int(-5)
44int(-5)
45string(110) "Life it seems, will fade away
46Drifting further everyday
47Getting lost within myself
48Nothing matters no one else"
49string(110) "Life it seems, will fade away
50Drifting further everyday
51Getting lost within myself
52Nothing matters no one else"
53string(110) "Life it seems, will fade away
54Drifting further everyday
55Getting lost within myself
56Nothing matters no one else"
57string(110) "Life it seems, will fade away
58Drifting further everyday
59Getting lost within myself
60Nothing matters no one else"
61Done
62