| 2221 | } |
| 2222 | |
| 2223 | void test_3_arg_mutable_buffer_async_write() |
| 2224 | { |
| 2225 | namespace bindns = std; |
| 2226 | using bindns::placeholders::_1; |
| 2227 | using bindns::placeholders::_2; |
| 2228 | |
| 2229 | boost::asio::io_context ioc; |
| 2230 | test_stream s(ioc); |
| 2231 | boost::asio::mutable_buffer buffers |
| 2232 | = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data)); |
| 2233 | |
| 2234 | s.reset(); |
| 2235 | bool called = false; |
| 2236 | boost::asio::async_write(s, buffers, |
| 2237 | bindns::bind(async_write_handler, |
| 2238 | _1, _2, sizeof(mutable_write_data), &called)); |
| 2239 | ioc.restart(); |
| 2240 | ioc.run(); |
| 2241 | BOOST_ASIO_CHECK(called); |
| 2242 | BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); |
| 2243 | |
| 2244 | s.reset(); |
| 2245 | s.next_write_length(1); |
| 2246 | called = false; |
| 2247 | boost::asio::async_write(s, buffers, |
| 2248 | bindns::bind(async_write_handler, |
| 2249 | _1, _2, sizeof(mutable_write_data), &called)); |
| 2250 | ioc.restart(); |
| 2251 | ioc.run(); |
| 2252 | BOOST_ASIO_CHECK(called); |
| 2253 | BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); |
| 2254 | |
| 2255 | s.reset(); |
| 2256 | s.next_write_length(10); |
| 2257 | called = false; |
| 2258 | boost::asio::async_write(s, buffers, |
| 2259 | bindns::bind(async_write_handler, |
| 2260 | _1, _2, sizeof(mutable_write_data), &called)); |
| 2261 | ioc.restart(); |
| 2262 | ioc.run(); |
| 2263 | BOOST_ASIO_CHECK(called); |
| 2264 | BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); |
| 2265 | |
| 2266 | s.reset(); |
| 2267 | int i = boost::asio::async_write(s, buffers, archetypes::lazy_handler()); |
| 2268 | BOOST_ASIO_CHECK(i == 42); |
| 2269 | ioc.restart(); |
| 2270 | ioc.run(); |
| 2271 | BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); |
| 2272 | |
| 2273 | s.reset(); |
| 2274 | called = false; |
| 2275 | boost::asio::async_write(s, buffers)( |
| 2276 | bindns::bind(async_write_handler, |
| 2277 | _1, _2, sizeof(mutable_write_data), &called)); |
| 2278 | ioc.restart(); |
| 2279 | ioc.run(); |
| 2280 | BOOST_ASIO_CHECK(called); |
nothing calls this directly
no test coverage detected