forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgzdeflate_basic1.phpt
92 lines (81 loc) · 1.88 KB
/
gzdeflate_basic1.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--TEST--
Test gzdeflate() function : basic functionality
--EXTENSIONS--
zlib
--SKIPIF--
<?php if (getenv('TRAVIS')) die('skip Currently fails on Travis'); ?>
--FILE--
<?php
/*
* add a comment here to say what the test is supposed to do
*/
include(__DIR__ . '/data.inc');
echo "*** Testing gzdeflate() : basic functionality ***\n";
// Initialise all required variables
$smallstring = "A small string to compress\n";
// Calling gzdeflate() with all possible arguments
// Compressing a big string
for($i = -1; $i < 10; $i++) {
echo "-- Compression level $i --\n";
$output = gzdeflate($data, $i);
var_dump(strcmp(gzinflate($output), $data));
}
// Compressing a smaller string
for($i = -1; $i < 10; $i++) {
echo "-- Compression level $i --\n";
$output = gzdeflate($smallstring, $i);
var_dump(strcmp(gzinflate($output), $smallstring));
}
// Calling gzdeflate() with just mandatory arguments
echo "\n-- Testing with no specified compression level --\n";
$output = gzdeflate($smallstring);
var_dump(strcmp(gzinflate($output), $smallstring));
?>
--EXPECT--
*** Testing gzdeflate() : basic functionality ***
-- Compression level -1 --
int(0)
-- Compression level 0 --
int(0)
-- Compression level 1 --
int(0)
-- Compression level 2 --
int(0)
-- Compression level 3 --
int(0)
-- Compression level 4 --
int(0)
-- Compression level 5 --
int(0)
-- Compression level 6 --
int(0)
-- Compression level 7 --
int(0)
-- Compression level 8 --
int(0)
-- Compression level 9 --
int(0)
-- Compression level -1 --
int(0)
-- Compression level 0 --
int(0)
-- Compression level 1 --
int(0)
-- Compression level 2 --
int(0)
-- Compression level 3 --
int(0)
-- Compression level 4 --
int(0)
-- Compression level 5 --
int(0)
-- Compression level 6 --
int(0)
-- Compression level 7 --
int(0)
-- Compression level 8 --
int(0)
-- Compression level 9 --
int(0)
-- Testing with no specified compression level --
int(0)