summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/dictionary_usage.phpt
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-05-15 02:18:53 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-05-15 02:28:38 +0200
commitdd17e18f41439ecf04eda48420771e1753ee77cd (patch)
treef2ccb24d745d03e5623f5e0aa42e25ec33aef089 /ext/zlib/tests/dictionary_usage.phpt
parenta129ded3c18e9446ca75c12d03f678177808a26e (diff)
downloadphp-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.phpt25
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)