File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / zlib / tests / 001.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:38 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
gzdeflate()/gzinflate()
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
<?php /* $Id: 001.phpt,v 1.1.1.2 2012/05/29 12:34:38 misho Exp $ */
$original = str_repeat("hallo php",4096);
$packed=gzdeflate($original);
echo strlen($packed)." ".strlen($original)."\n";
$unpacked=gzinflate($packed);
if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";

/* with explicit compression level, length */
$original = str_repeat("hallo php",4096);
$packed=gzdeflate($original, 9);
echo strlen($packed)." ".strlen($original)."\n";
$unpacked=gzinflate($packed, 40000);
if (strcmp($original,$unpacked)==0) echo "Strings are equal\n";

$original = 'aaaaaaaaaaaaaaa';
$packed=gzdeflate($original);
echo strlen($packed)." ".strlen($original)."\n";
$unpacked=gzinflate($packed);
if (strcmp($original,$unpacked)==0) echo "Strings are equal";
?>
--EXPECT--
100 36864
Strings are equal
100 36864
Strings are equal
5 15
Strings are equal

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>