MCPcopy Create free account
hub / github.com/boostorg/beast / failgrind

Method failgrind

test/beast/http/basic_parser.cpp:238–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236
237 template<class Parser>
238 void
239 failgrind(string_view msg, error_code const& result)
240 {
241 for(std::size_t i = 1; i < msg.size() - 1; ++i)
242 {
243 Parser p;
244 p.eager(true);
245 error_code ec;
246 buffers_suffix<net::const_buffer> cb{
247 boost::in_place_init, msg.data(), msg.size()};
248 auto n = p.put(buffers_prefix(i, cb), ec);
249 if(ec == result)
250 {
251 pass();
252 continue;
253 }
254 if(! BEAST_EXPECTS(
255 ec == error::need_more, ec.message()))
256 continue;
257 if(! BEAST_EXPECT(! p.is_done()))
258 continue;
259 cb.consume(n);
260 n = p.put(cb, ec);
261 if(! ec)
262 p.put_eof(ec);
263 BEAST_EXPECTS(ec == result, ec.message());
264 }
265 for(std::size_t i = 1; i < msg.size() - 1; ++i)
266 {
267 Parser p;
268 p.eager(true);
269 error_code ec;
270 p.put(buffers_cat(
271 net::const_buffer{msg.data(), i},
272 net::const_buffer{
273 msg.data() + i, msg.size() - i}), ec);
274 if(! ec)
275 p.put_eof(ec);
276 BEAST_EXPECTS(ec == result, ec.message());
277 }
278 }
279
280 //--------------------------------------------------------------------------
281

Callers

nothing calls this directly

Calls 8

buffers_prefixFunction · 0.85
eagerMethod · 0.80
messageMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
putMethod · 0.45
is_doneMethod · 0.45
consumeMethod · 0.45

Tested by

no test coverage detected