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

Function test_4_arg_mutable_buffer_async_write

test/write.cpp:2936–3252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2934}
2935
2936void test_4_arg_mutable_buffer_async_write()
2937{
2938 namespace bindns = std;
2939 using bindns::placeholders::_1;
2940 using bindns::placeholders::_2;
2941
2942 boost::asio::io_context ioc;
2943 test_stream s(ioc);
2944 boost::asio::mutable_buffer buffers
2945 = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
2946
2947 s.reset();
2948 bool called = false;
2949 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
2950 bindns::bind(async_write_handler,
2951 _1, _2, sizeof(mutable_write_data), &called));
2952 ioc.restart();
2953 ioc.run();
2954 BOOST_ASIO_CHECK(called);
2955 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
2956
2957 s.reset();
2958 s.next_write_length(1);
2959 called = false;
2960 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
2961 bindns::bind(async_write_handler,
2962 _1, _2, sizeof(mutable_write_data), &called));
2963 ioc.restart();
2964 ioc.run();
2965 BOOST_ASIO_CHECK(called);
2966 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
2967
2968 s.reset();
2969 s.next_write_length(10);
2970 called = false;
2971 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
2972 bindns::bind(async_write_handler,
2973 _1, _2, sizeof(mutable_write_data), &called));
2974 ioc.restart();
2975 ioc.run();
2976 BOOST_ASIO_CHECK(called);
2977 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
2978
2979 s.reset();
2980 called = false;
2981 boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1),
2982 bindns::bind(async_write_handler,
2983 _1, _2, sizeof(mutable_write_data), &called));
2984 ioc.restart();
2985 ioc.run();
2986 BOOST_ASIO_CHECK(called);
2987 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
2988
2989 s.reset();
2990 s.next_write_length(1);
2991 called = false;
2992 boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1),
2993 bindns::bind(async_write_handler,

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