aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_compression.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-22 18:08:08 -0400
committerJack Lloyd <[email protected]>2017-09-22 18:08:08 -0400
commit034a12e6361be524823d8701b66c3ca5c78e6243 (patch)
treebc22824fa4b079fc779a0ca47c9f02e3d5c507d1 /src/tests/test_compression.cpp
parent97cb5cd996e64f9979b5969457a7fe2bde073a64 (diff)
Improve compression tests slightly
Fix a bug that affected bzip2 - the bzip2 library does not like being called with avail_in == 0 and BZ_RUN, it returns PARAM_ERROR. Just return in that case and ignore the call.
Diffstat (limited to 'src/tests/test_compression.cpp')
-rw-r--r--src/tests/test_compression.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/tests/test_compression.cpp b/src/tests/test_compression.cpp
index 10e93eb79..4cb9ece8b 100644
--- a/src/tests/test_compression.cpp
+++ b/src/tests/test_compression.cpp
@@ -125,15 +125,27 @@ class Compression_Tests final : public Test
const Botan::secure_vector<uint8_t>& msg)
{
Botan::secure_vector<uint8_t> compressed = msg;
+ Botan::secure_vector<uint8_t> flush_bits;
+ Botan::secure_vector<uint8_t> final_bits;
c.start(level);
- c.finish(compressed);
+ c.update(compressed);
+ c.update(flush_bits, 0, true);
+ c.finish(final_bits);
+
+ compressed += flush_bits;
+ compressed += final_bits;
const size_t c_size = compressed.size();
Botan::secure_vector<uint8_t> decompressed = compressed;
d.start();
- d.finish(decompressed);
+ d.update(decompressed);
+
+ Botan::secure_vector<uint8_t> final_outputs;
+ d.finish(final_outputs);
+
+ decompressed += final_outputs;
result.test_eq("compression round tripped", msg, decompressed);
return c_size;