diff options
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) |