MCPcopy Create free account
hub / github.com/boostorg/asio / test_4_arg_vector_buffers_async_write

Function test_4_arg_vector_buffers_async_write

test/write.cpp:3894–4212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3892}
3893
3894void test_4_arg_vector_buffers_async_write()
3895{
3896 namespace bindns = std;
3897 using bindns::placeholders::_1;
3898 using bindns::placeholders::_2;
3899
3900 boost::asio::io_context ioc;
3901 test_stream s(ioc);
3902 std::vector<boost::asio::const_buffer> buffers;
3903 buffers.push_back(boost::asio::buffer(write_data, 32));
3904 buffers.push_back(boost::asio::buffer(write_data, 39) + 32);
3905 buffers.push_back(boost::asio::buffer(write_data) + 39);
3906
3907 s.reset();
3908 bool called = false;
3909 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
3910 bindns::bind(async_write_handler,
3911 _1, _2, sizeof(write_data), &called));
3912 ioc.restart();
3913 ioc.run();
3914 BOOST_ASIO_CHECK(called);
3915 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
3916
3917 s.reset();
3918 s.next_write_length(1);
3919 called = false;
3920 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
3921 bindns::bind(async_write_handler,
3922 _1, _2, sizeof(write_data), &called));
3923 ioc.restart();
3924 ioc.run();
3925 BOOST_ASIO_CHECK(called);
3926 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
3927
3928 s.reset();
3929 s.next_write_length(10);
3930 called = false;
3931 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
3932 bindns::bind(async_write_handler,
3933 _1, _2, sizeof(write_data), &called));
3934 ioc.restart();
3935 ioc.run();
3936 BOOST_ASIO_CHECK(called);
3937 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
3938
3939 s.reset();
3940 called = false;
3941 boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1),
3942 bindns::bind(async_write_handler,
3943 _1, _2, sizeof(write_data), &called));
3944 ioc.restart();
3945 ioc.run();
3946 BOOST_ASIO_CHECK(called);
3947 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
3948
3949 s.reset();
3950 s.next_write_length(1);
3951 called = false;

Callers

nothing calls this directly

Calls 13

bufferFunction · 0.85
async_writeFunction · 0.85
transfer_at_leastFunction · 0.85
transfer_exactlyFunction · 0.85
lazy_handlerClass · 0.85
restartMethod · 0.80
short_transferClass · 0.70
transfer_allClass · 0.50
bindFunction · 0.50
resetMethod · 0.45
runMethod · 0.45
check_buffersMethod · 0.45

Tested by

no test coverage detected