| 203 | |
| 204 | template<class Wrap> |
| 205 | void |
| 206 | doTestWriteDeflate(Wrap const& w) |
| 207 | { |
| 208 | permessage_deflate pmd; |
| 209 | pmd.client_enable = true; |
| 210 | pmd.server_enable = true; |
| 211 | pmd.compLevel = 1; |
| 212 | |
| 213 | // deflate |
| 214 | doTest(pmd, [&](ws_type& ws) |
| 215 | { |
| 216 | auto const& s = random_string(); |
| 217 | ws.binary(true); |
| 218 | w.write(ws, net::buffer(s)); |
| 219 | flat_buffer b; |
| 220 | w.read(ws, b); |
| 221 | BEAST_EXPECT(buffers_to_string(b.data()) == s); |
| 222 | }); |
| 223 | |
| 224 | // deflate, continuation |
| 225 | doTest(pmd, [&](ws_type& ws) |
| 226 | { |
| 227 | std::string const s = "Hello"; |
| 228 | std::size_t const chop = 3; |
| 229 | BOOST_ASSERT(chop < s.size()); |
| 230 | // This call should produce no |
| 231 | // output due to compression latency. |
| 232 | w.write_some(ws, false, |
| 233 | net::buffer(s.data(), chop)); |
| 234 | w.write_some(ws, true, net::buffer( |
| 235 | s.data() + chop, s.size() - chop)); |
| 236 | flat_buffer b; |
| 237 | w.read(ws, b); |
| 238 | BEAST_EXPECT(buffers_to_string(b.data()) == s); |
| 239 | }); |
| 240 | |
| 241 | // deflate, no context takeover |
| 242 | pmd.client_no_context_takeover = true; |
| 243 | doTest(pmd, [&](ws_type& ws) |
| 244 | { |
| 245 | auto const& s = random_string(); |
| 246 | ws.binary(true); |
| 247 | w.write(ws, net::buffer(s)); |
| 248 | flat_buffer b; |
| 249 | w.read(ws, b); |
| 250 | BEAST_EXPECT(buffers_to_string(b.data()) == s); |
| 251 | }); |
| 252 | } |
| 253 | |
| 254 | void |
| 255 | testWrite() |
nothing calls this directly
no test coverage detected