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

Function any_completion_handler_invocation_test

test/any_completion_handler.cpp:227–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227void any_completion_handler_invocation_test()
228{
229 int count = 0;
230 boost::system::error_code ec;
231
232 boost::asio::any_completion_handler<void()> h1(
233 bindns::bind(&increment, &count));
234
235 BOOST_ASIO_CHECK(count == 0);
236
237 std::move(h1)();
238
239 BOOST_ASIO_CHECK(count == 1);
240
241 boost::asio::any_completion_handler<void(boost::system::error_code)> h2(
242 bindns::bind(&increment_with_error,
243 bindns::placeholders::_1, &ec, &count));
244
245 BOOST_ASIO_CHECK(!ec);
246 BOOST_ASIO_CHECK(count == 1);
247
248 std::move(h2)(boost::asio::error::eof);
249
250 BOOST_ASIO_CHECK(ec == boost::asio::error::eof);
251 BOOST_ASIO_CHECK(count == 2);
252}
253
254BOOST_ASIO_TEST_SUITE
255(

Callers

nothing calls this directly

Calls 1

bindFunction · 0.50

Tested by

no test coverage detected