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

Function test_4_arg_const_buffer_async_write

test/write.cpp:2618–2934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2616}
2617
2618void test_4_arg_const_buffer_async_write()
2619{
2620 namespace bindns = std;
2621 using bindns::placeholders::_1;
2622 using bindns::placeholders::_2;
2623
2624 boost::asio::io_context ioc;
2625 test_stream s(ioc);
2626 boost::asio::const_buffer buffers
2627 = boost::asio::buffer(write_data, sizeof(write_data));
2628
2629 s.reset();
2630 bool called = false;
2631 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
2632 bindns::bind(async_write_handler,
2633 _1, _2, sizeof(write_data), &called));
2634 ioc.restart();
2635 ioc.run();
2636 BOOST_ASIO_CHECK(called);
2637 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
2638
2639 s.reset();
2640 s.next_write_length(1);
2641 called = false;
2642 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
2643 bindns::bind(async_write_handler,
2644 _1, _2, sizeof(write_data), &called));
2645 ioc.restart();
2646 ioc.run();
2647 BOOST_ASIO_CHECK(called);
2648 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
2649
2650 s.reset();
2651 s.next_write_length(10);
2652 called = false;
2653 boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
2654 bindns::bind(async_write_handler,
2655 _1, _2, sizeof(write_data), &called));
2656 ioc.restart();
2657 ioc.run();
2658 BOOST_ASIO_CHECK(called);
2659 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
2660
2661 s.reset();
2662 called = false;
2663 boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1),
2664 bindns::bind(async_write_handler,
2665 _1, _2, sizeof(write_data), &called));
2666 ioc.restart();
2667 ioc.run();
2668 BOOST_ASIO_CHECK(called);
2669 BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data)));
2670
2671 s.reset();
2672 s.next_write_length(1);
2673 called = false;
2674 boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1),
2675 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