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