aboutsummaryrefslogtreecommitdiff
path: root/python/tests/roundtrip_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests/roundtrip_test.py')
-rw-r--r--python/tests/roundtrip_test.py48
1 files changed, 0 insertions, 48 deletions
diff --git a/python/tests/roundtrip_test.py b/python/tests/roundtrip_test.py
deleted file mode 100644
index 610c4f3..0000000
--- a/python/tests/roundtrip_test.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/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.c
-../common/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):
- filename = os.path.abspath(filename)
- print('Roundtrip testing file "%s" at quality %d' %
- (os.path.basename(filename), quality))
- compressed = os.path.splitext(filename)[0] + ".bro"
- uncompressed = os.path.splitext(filename)[0] + ".unbro"
- check_call([PYTHON, BRO, "-f", "-q", str(quality), "-i", filename,
- "-o", compressed], env=TEST_ENV)
- check_call([PYTHON, BRO, "-f", "-d", "-i", compressed, "-o",
- uncompressed], env=TEST_ENV)
- if diff_q(filename, uncompressed) != 0:
- sys.exit(1)
- # Test the streaming version
- with open(filename, "rb") as infile, \
- open(uncompressed, "wb") as outfile:
- p = Popen([PYTHON, BRO, "-q", str(quality)], stdin=infile,
- stdout=PIPE, env=TEST_ENV)
- check_call([PYTHON, BRO, "-d"], stdin=p.stdout, stdout=outfile,
- env=TEST_ENV)
- if diff_q(filename, uncompressed) != 0:
- sys.exit(1)
- try:
- os.unlink(compressed)
- os.unlink(uncompressed)
- except OSError:
- pass