| 572 | } |
| 573 | |
| 574 | void test_streambuf_read_until_match_condition() |
| 575 | { |
| 576 | #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) |
| 577 | boost::asio::io_context ioc; |
| 578 | test_stream s(ioc); |
| 579 | boost::asio::streambuf sb1; |
| 580 | boost::asio::streambuf sb2(25); |
| 581 | boost::system::error_code ec; |
| 582 | |
| 583 | s.reset(read_data, sizeof(read_data)); |
| 584 | sb1.consume(sb1.size()); |
| 585 | std::size_t length = boost::asio::read_until(s, sb1, match_char('Z')); |
| 586 | BOOST_ASIO_CHECK(length == 26); |
| 587 | |
| 588 | s.reset(read_data, sizeof(read_data)); |
| 589 | s.next_read_length(1); |
| 590 | sb1.consume(sb1.size()); |
| 591 | length = boost::asio::read_until(s, sb1, match_char('Z')); |
| 592 | BOOST_ASIO_CHECK(length == 26); |
| 593 | |
| 594 | s.reset(read_data, sizeof(read_data)); |
| 595 | s.next_read_length(10); |
| 596 | sb1.consume(sb1.size()); |
| 597 | length = boost::asio::read_until(s, sb1, match_char('Z')); |
| 598 | BOOST_ASIO_CHECK(length == 26); |
| 599 | |
| 600 | s.reset(read_data, sizeof(read_data)); |
| 601 | sb1.consume(sb1.size()); |
| 602 | length = boost::asio::read_until(s, sb1, match_char('Z'), ec); |
| 603 | BOOST_ASIO_CHECK(!ec); |
| 604 | BOOST_ASIO_CHECK(length == 26); |
| 605 | |
| 606 | s.reset(read_data, sizeof(read_data)); |
| 607 | s.next_read_length(1); |
| 608 | sb1.consume(sb1.size()); |
| 609 | length = boost::asio::read_until(s, sb1, match_char('Z'), ec); |
| 610 | BOOST_ASIO_CHECK(!ec); |
| 611 | BOOST_ASIO_CHECK(length == 26); |
| 612 | |
| 613 | s.reset(read_data, sizeof(read_data)); |
| 614 | s.next_read_length(10); |
| 615 | sb1.consume(sb1.size()); |
| 616 | length = boost::asio::read_until(s, sb1, match_char('Z'), ec); |
| 617 | BOOST_ASIO_CHECK(!ec); |
| 618 | BOOST_ASIO_CHECK(length == 26); |
| 619 | |
| 620 | s.reset(read_data, sizeof(read_data)); |
| 621 | sb2.consume(sb2.size()); |
| 622 | length = boost::asio::read_until(s, sb2, match_char('Z'), ec); |
| 623 | BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); |
| 624 | BOOST_ASIO_CHECK(length == 0); |
| 625 | |
| 626 | s.reset(read_data, sizeof(read_data)); |
| 627 | s.next_read_length(1); |
| 628 | sb2.consume(sb2.size()); |
| 629 | length = boost::asio::read_until(s, sb2, match_char('Z'), ec); |
| 630 | BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); |
| 631 | BOOST_ASIO_CHECK(length == 0); |
nothing calls this directly
no test coverage detected