From d1ff4405aa4654f0553266544a997630a1efd2ba Mon Sep 17 00:00:00 2001 From: Damian Jarek Date: Tue, 27 Aug 2019 08:39:27 +0200 Subject: [PATCH] Add test for flush::trees with uncompressed strategy Signed-off-by: Damian Jarek --- test/beast/zlib/inflate_stream.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/beast/zlib/inflate_stream.cpp b/test/beast/zlib/inflate_stream.cpp index e7320aeb..10c1d447 100644 --- a/test/beast/zlib/inflate_stream.cpp +++ b/test/beast/zlib/inflate_stream.cpp @@ -477,6 +477,28 @@ public: BEAST_EXPECT(out == "Hello"); } + void testUncompressedFlushTrees() + { + std::string out(5, 0); + z_params zs; + inflate_stream is; + is.reset(); + boost::system::error_code ec; + std::initializer_list in = { + 0x00, 0x05, 0x00, 0xfa, 0xff, 0x48, 0x65, 0x6c, + 0x6c, 0x6f, 0x00, 0x00}; + zs.next_in = &*in.begin(); + zs.next_out = &out[0]; + zs.avail_in = in.size(); + zs.avail_out = out.size(); + is.write(zs, Flush::trees, ec); + BEAST_EXPECT(!ec); + is.write(zs, Flush::sync, ec); + BEAST_EXPECT(!ec); + BEAST_EXPECT(zs.avail_out == 0); + BEAST_EXPECT(out == "Hello"); + } + void run() override { @@ -487,6 +509,7 @@ public: testInflateErrors(); testInvalidSettings(); testFixedHuffmanFlushTrees(); + testUncompressedFlushTrees(); } };