Annotation of embedaddon/php/ext/zlib/tests/gzencode_basic1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test gzencode() function : basic functionality
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded("zlib")) {
! 6: print "skip - ZLIB extension not loaded";
! 7: }
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: /* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] )
! 12: * Description: Gzip-compress a string
! 13: * Source code: ext/zlib/zlib.c
! 14: * Alias to functions:
! 15: */
! 16:
! 17: /*
! 18: * Test basic function of gzencode
! 19: */
! 20:
! 21: include(dirname(__FILE__) . '/data.inc');
! 22:
! 23: echo "*** Testing gzencode() : basic functionality ***\n";
! 24:
! 25: // Initialise all required variables
! 26:
! 27: $smallstring = "A small string to compress\n";
! 28:
! 29:
! 30: // Calling gzencode() with various compression levels
! 31:
! 32: // Compressing a big string
! 33: for($i = -1; $i < 10; $i++) {
! 34: echo "-- Compression level $i --\n";
! 35: $output = gzencode($data, $i);
! 36:
! 37: // Clear OS byte before encode
! 38: $output[9] = "\x00";
! 39:
! 40: var_dump(md5($output));
! 41: }
! 42:
! 43: // Compressing a smaller string
! 44: for($i = -1; $i < 10; $i++) {
! 45: echo "-- Compression level $i --\n";
! 46: $output = gzencode($smallstring, $i);
! 47:
! 48: // Clear OS byte before encode
! 49: $output[9] = "\x00";
! 50:
! 51: var_dump(md5($output));
! 52: }
! 53:
! 54: ?>
! 55: ===Done===
! 56: --EXPECTF--
! 57: *** Testing gzencode() : basic functionality ***
! 58: -- Compression level -1 --
! 59: string(32) "d9ede02415ce91d21e5a94274e2b9c42"
! 60: -- Compression level 0 --
! 61: string(32) "67aaf60426bb2cbd86d7fe530cb12306"
! 62: -- Compression level 1 --
! 63: string(32) "bce9c439cf767c1988ff4881b287d1ce"
! 64: -- Compression level 2 --
! 65: string(32) "7ddbfed63a76c42808722b66f1c133fc"
! 66: -- Compression level 3 --
! 67: string(32) "ca2b85d194dfa2a4e8a162b646c99265"
! 68: -- Compression level 4 --
! 69: string(32) "cfe28033eaf260bc33ddc04b53d3ba39"
! 70: -- Compression level 5 --
! 71: string(32) "ae357fada2b515422f8bea0aa3bcc48f"
! 72: -- Compression level 6 --
! 73: string(32) "d9ede02415ce91d21e5a94274e2b9c42"
! 74: -- Compression level 7 --
! 75: string(32) "d9ede02415ce91d21e5a94274e2b9c42"
! 76: -- Compression level 8 --
! 77: string(32) "d9ede02415ce91d21e5a94274e2b9c42"
! 78: -- Compression level 9 --
! 79: string(32) "d9ede02415ce91d21e5a94274e2b9c42"
! 80: -- Compression level -1 --
! 81: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 82: -- Compression level 0 --
! 83: string(32) "36220d650930849b67e8e0622f9bf270"
! 84: -- Compression level 1 --
! 85: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 86: -- Compression level 2 --
! 87: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 88: -- Compression level 3 --
! 89: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 90: -- Compression level 4 --
! 91: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 92: -- Compression level 5 --
! 93: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 94: -- Compression level 6 --
! 95: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 96: -- Compression level 7 --
! 97: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 98: -- Compression level 8 --
! 99: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 100: -- Compression level 9 --
! 101: string(32) "f77bd31e1e4dd11d12828fb661a08010"
! 102: ===Done===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>