summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/testfiles/trailing_data.zlibbin0 -> 20 bytes
-rw-r--r--test/zlibstream_test.h21
2 files changed, 21 insertions, 0 deletions
diff --git a/test/testfiles/trailing_data.zlib b/test/testfiles/trailing_data.zlib
new file mode 100644
index 0000000000..83848f3024
--- /dev/null
+++ b/test/testfiles/trailing_data.zlib
Binary files differ
diff --git a/test/zlibstream_test.h b/test/zlibstream_test.h
index f8308cf7c5..e76745f80f 100644
--- a/test/zlibstream_test.h
+++ b/test/zlibstream_test.h
@@ -133,6 +133,27 @@ public:
}
}
+ void test_inflate_trailing()
+ {
+ //This file contains additional uncompressed data after the zlib-compressed data
+ std::ifstream file("trailing_data.zlib", std::ios::binary);
+ izlibstream izls(file, 32);
+ TS_ASSERT(file && izls);
+
+ std::string str;
+ izls >> str;
+ TS_ASSERT(izls);
+ TS_ASSERT(izls.eof());
+ TS_ASSERT_EQUALS(str, "foobar");
+
+ //Now read the uncompressed data
+ TS_ASSERT(file);
+ TS_ASSERT(!file.eof());
+ file >> str;
+ TS_ASSERT(!file.bad());
+ TS_ASSERT_EQUALS(str, "barbaz");
+ }
+
void test_deflate_zlib()
{
//Here we assume that inflating works and has already been tested