| 380 | |
| 381 | template<class F> |
| 382 | static |
| 383 | void |
| 384 | grind(string_view s, F const& f, |
| 385 | const parse_options& po = parse_options()) |
| 386 | { |
| 387 | try |
| 388 | { |
| 389 | grind_one(s, {}, f, po); |
| 390 | |
| 391 | fail_loop([&](storage_ptr const& sp) |
| 392 | { |
| 393 | grind_one(s, sp, f, po); |
| 394 | }); |
| 395 | |
| 396 | if(s.size() > 1) |
| 397 | { |
| 398 | // Destroy the stream_parser at every |
| 399 | // split point to check leaks. |
| 400 | for(std::size_t i = 1; |
| 401 | i < s.size(); ++i) |
| 402 | { |
| 403 | fail_resource mr; |
| 404 | mr.fail_max = 0; |
| 405 | stream_parser p(storage_ptr(), po); |
| 406 | system::error_code ec; |
| 407 | p.reset(&mr); |
| 408 | p.write(s.data(), i, ec); |
| 409 | if(BOOST_TEST(! ec)) |
| 410 | p.write( |
| 411 | s.data() + i, |
| 412 | s.size() - i, ec); |
| 413 | if(BOOST_TEST(! ec)) |
| 414 | p.finish(ec); |
| 415 | if(BOOST_TEST(! ec)) |
| 416 | f(p.release(), po); |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | catch(std::exception const&) |
| 421 | { |
| 422 | BOOST_TEST_FAIL(); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | static |
| 427 | void |
nothing calls this directly
no test coverage detected