summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/libh2o/deps/brotli/python/tests/custom_dictionary_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
commitbe1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch)
tree9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/libh2o/deps/brotli/python/tests/custom_dictionary_test.py
parentInitial commit. (diff)
downloadnetdata-upstream.tar.xz
netdata-upstream.zip
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/deps/brotli/python/tests/custom_dictionary_test.py')
-rw-r--r--web/server/h2o/libh2o/deps/brotli/python/tests/custom_dictionary_test.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/deps/brotli/python/tests/custom_dictionary_test.py b/web/server/h2o/libh2o/deps/brotli/python/tests/custom_dictionary_test.py
new file mode 100644
index 00000000..afbf07a8
--- /dev/null
+++ b/web/server/h2o/libh2o/deps/brotli/python/tests/custom_dictionary_test.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+from __future__ import print_function
+import sys
+import os
+from subprocess import check_call, Popen, PIPE
+
+from test_utils import PYTHON, BRO, TEST_ENV, diff_q
+
+
+INPUTS = """\
+testdata/alice29.txt
+testdata/asyoulik.txt
+testdata/lcet10.txt
+testdata/plrabn12.txt
+../enc/encode.cc
+../enc/dictionary.h
+../dec/decode.c
+%s
+""" % BRO
+
+os.chdir(os.path.abspath("../../tests"))
+for filename in INPUTS.splitlines():
+ for quality in (1, 6, 9, 11):
+ for lgwin in (10, 15, 20, 24):
+ filename = os.path.abspath(filename)
+ print('Roundtrip testing file "%s" at quality %d with lg(win)=%d and auto-custom-dictionary' %
+ (os.path.basename(filename), quality, lgwin))
+ compressed = os.path.splitext(filename)[0] + ".custom_bro"
+ uncompressed = os.path.splitext(filename)[0] + ".custom_unbro"
+ check_call([PYTHON, BRO, "-f", "-q", str(quality), "-i", filename,
+ "-o", compressed, "--lgwin", str(lgwin),
+ "--custom-dictionary", filename], env=TEST_ENV)
+ check_call([PYTHON, BRO, "-f", "-d", "-i", compressed, "-o",
+ uncompressed, "--custom-dictionary", filename], env=TEST_ENV)
+ if diff_q(filename, uncompressed) != 0:
+ sys.exit(1)