|
35 | 35 | #include "CppUnit/TestSuite.h" |
36 | 36 | #include "Poco/InflatingStream.h" |
37 | 37 | #include "Poco/DeflatingStream.h" |
| 38 | +#include "Poco/MemoryStream.h" |
38 | 39 | #include "Poco/StreamCopier.h" |
| 40 | +#include "Poco/Buffer.h" |
39 | 41 | #include <sstream> |
40 | 42 |
|
41 | 43 |
|
@@ -113,6 +115,22 @@ void ZLibTest::testDeflate3() |
113 | 115 | } |
114 | 116 |
|
115 | 117 |
|
| 118 | +void ZLibTest::testDeflate4() |
| 119 | +{ |
| 120 | + Poco::Buffer<char> buffer(1024); |
| 121 | + Poco::MemoryOutputStream ostr(buffer.begin(), static_cast<std::streamsize>(buffer.size())); |
| 122 | + DeflatingOutputStream deflater(ostr, -10, Z_BEST_SPEED); |
| 123 | + std::string data(36828, 'x'); |
| 124 | + deflater << data; |
| 125 | + deflater.close(); |
| 126 | + Poco::MemoryInputStream istr(buffer.begin(), ostr.charsWritten()); |
| 127 | + InflatingInputStream inflater(istr, -10); |
| 128 | + std::string data2; |
| 129 | + inflater >> data2; |
| 130 | + assert (data2 == data); |
| 131 | +} |
| 132 | + |
| 133 | + |
116 | 134 | void ZLibTest::testGzip1() |
117 | 135 | { |
118 | 136 | std::stringstream buffer; |
@@ -196,6 +214,7 @@ CppUnit::Test* ZLibTest::suite() |
196 | 214 | CppUnit_addTest(pSuite, ZLibTest, testDeflate1); |
197 | 215 | CppUnit_addTest(pSuite, ZLibTest, testDeflate2); |
198 | 216 | CppUnit_addTest(pSuite, ZLibTest, testDeflate3); |
| 217 | + CppUnit_addTest(pSuite, ZLibTest, testDeflate4); |
199 | 218 | CppUnit_addTest(pSuite, ZLibTest, testGzip1); |
200 | 219 | CppUnit_addTest(pSuite, ZLibTest, testGzip2); |
201 | 220 | CppUnit_addTest(pSuite, ZLibTest, testGzip3); |
|
0 commit comments