xref: /PHP-7.4/ext/bz2/tests/005.phpt (revision d574df63)
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());
14var_dump(bzcompress(1,1,1));
15var_dump(bzcompress($string, 100));
16var_dump(bzcompress($string, 100, -1));
17var_dump(bzcompress($string, 100, 1000));
18var_dump(bzcompress($string, -1, 1));
19
20$data = bzcompress($string);
21$data2 = bzcompress($string, 1, 10);
22
23$data3 = $data2;
24$data3[3] = 0;
25
26var_dump(bzdecompress());
27var_dump(bzdecompress(1,1,1));
28var_dump(bzdecompress(1,1));
29var_dump(bzdecompress($data3));
30var_dump(bzdecompress($data3,1));
31
32var_dump(bzdecompress($data, -1));
33var_dump(bzdecompress($data, 0));
34var_dump(bzdecompress($data, 1000));
35var_dump(bzdecompress($data));
36var_dump(bzdecompress($data2));
37
38echo "Done\n";
39?>
40--EXPECTF--
41Warning: bzcompress() expects at least 1 parameter, 0 given in %s on line %d
42NULL
43string(%d) "BZ%a"
44int(-2)
45int(-2)
46int(-2)
47int(-2)
48
49Warning: bzdecompress() expects at least 1 parameter, 0 given in %s on line %d
50bool(false)
51
52Warning: bzdecompress() expects at most 2 parameters, 3 given in %s on line %d
53bool(false)
54int(-5)
55int(-5)
56int(-5)
57bool(false)
58string(110) "Life it seems, will fade away
59Drifting further everyday
60Getting lost within myself
61Nothing matters no one else"
62bool(false)
63string(110) "Life it seems, will fade away
64Drifting further everyday
65Getting lost within myself
66Nothing matters no one else"
67string(110) "Life it seems, will fade away
68Drifting further everyday
69Getting lost within myself
70Nothing matters no one else"
71Done
72