| 842 | } |
| 843 | |
| 844 | void test_streambuf_async_read_until_char() |
| 845 | { |
| 846 | #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) |
| 847 | namespace bindns = std; |
| 848 | using bindns::placeholders::_1; |
| 849 | using bindns::placeholders::_2; |
| 850 | |
| 851 | boost::asio::io_context ioc; |
| 852 | test_stream s(ioc); |
| 853 | boost::asio::streambuf sb1; |
| 854 | boost::asio::streambuf sb2(25); |
| 855 | boost::system::error_code ec; |
| 856 | std::size_t length; |
| 857 | bool called; |
| 858 | |
| 859 | s.reset(read_data, sizeof(read_data)); |
| 860 | ec = boost::system::error_code(); |
| 861 | length = 0; |
| 862 | called = false; |
| 863 | sb1.consume(sb1.size()); |
| 864 | boost::asio::async_read_until(s, sb1, 'Z', |
| 865 | bindns::bind(async_read_handler, _1, &ec, |
| 866 | _2, &length, &called)); |
| 867 | ioc.restart(); |
| 868 | ioc.run(); |
| 869 | BOOST_ASIO_CHECK(called); |
| 870 | BOOST_ASIO_CHECK(!ec); |
| 871 | BOOST_ASIO_CHECK(length == 26); |
| 872 | |
| 873 | s.reset(read_data, sizeof(read_data)); |
| 874 | s.next_read_length(1); |
| 875 | ec = boost::system::error_code(); |
| 876 | length = 0; |
| 877 | called = false; |
| 878 | sb1.consume(sb1.size()); |
| 879 | boost::asio::async_read_until(s, sb1, 'Z', |
| 880 | bindns::bind(async_read_handler, _1, &ec, |
| 881 | _2, &length, &called)); |
| 882 | ioc.restart(); |
| 883 | ioc.run(); |
| 884 | BOOST_ASIO_CHECK(called); |
| 885 | BOOST_ASIO_CHECK(!ec); |
| 886 | BOOST_ASIO_CHECK(length == 26); |
| 887 | |
| 888 | s.reset(read_data, sizeof(read_data)); |
| 889 | s.next_read_length(10); |
| 890 | ec = boost::system::error_code(); |
| 891 | length = 0; |
| 892 | called = false; |
| 893 | sb1.consume(sb1.size()); |
| 894 | boost::asio::async_read_until(s, sb1, 'Z', |
| 895 | bindns::bind(async_read_handler, _1, &ec, |
| 896 | _2, &length, &called)); |
| 897 | ioc.restart(); |
| 898 | ioc.run(); |
| 899 | BOOST_ASIO_CHECK(called); |
| 900 | BOOST_ASIO_CHECK(!ec); |
| 901 | BOOST_ASIO_CHECK(length == 26); |
nothing calls this directly
no test coverage detected