diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-05-15 02:18:53 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-05-15 02:28:38 +0200 |
commit | dd17e18f41439ecf04eda48420771e1753ee77cd (patch) | |
tree | f2ccb24d745d03e5623f5e0aa42e25ec33aef089 /ext/zlib/tests/dictionary_usage.phpt | |
parent | a129ded3c18e9446ca75c12d03f678177808a26e (diff) | |
download | php-git-dd17e18f41439ecf04eda48420771e1753ee77cd.tar.gz |
Add dictionary option to {in,de}flate_init()
Diffstat (limited to 'ext/zlib/tests/dictionary_usage.phpt')
-rw-r--r-- | ext/zlib/tests/dictionary_usage.phpt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/zlib/tests/dictionary_usage.phpt b/ext/zlib/tests/dictionary_usage.phpt new file mode 100644 index 0000000000..b73cd52d25 --- /dev/null +++ b/ext/zlib/tests/dictionary_usage.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test dictionary usage on zlib methods +--FILE-- +<?php + +$dict = range("a", "z"); + +$r = deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => $dict]); +$a = deflate_add($r, "abdcde", ZLIB_FINISH); +var_dump($a); + +$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => $dict]); +var_dump(inflate_add($r, $a, ZLIB_FINISH)); + + +$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => ["8"] + range("a", "z")]); +var_dump(inflate_add($r, $a, ZLIB_FINISH)); + +?> +--EXPECTF-- +string(%d) "%s" +string(6) "abdcde" + +Warning: inflate_add(): dictionary does match expected dictionary (incorrect adler32 hash) in %s on line %d +bool(false) |