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

Function test_connect_iter

test/connect.cpp:422–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422void test_connect_iter()
423{
424 connection_sink sink;
425 boost::asio::io_context io_context;
426 boost::asio::ip::tcp::socket socket(io_context);
427 std::vector<boost::asio::ip::tcp::endpoint> endpoints;
428 const std::vector<boost::asio::ip::tcp::endpoint>& cendpoints = endpoints;
429 std::vector<boost::asio::ip::tcp::endpoint>::const_iterator result;
430
431 try
432 {
433 result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end());
434 BOOST_ASIO_CHECK(false);
435 }
436 catch (boost::system::system_error& e)
437 {
438 BOOST_ASIO_CHECK(e.code() == boost::asio::error::not_found);
439 }
440
441 endpoints.push_back(sink.target_endpoint());
442
443 result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end());
444 BOOST_ASIO_CHECK(result == cendpoints.begin());
445
446 endpoints.push_back(sink.target_endpoint());
447
448 result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end());
449 BOOST_ASIO_CHECK(result == cendpoints.begin());
450
451 endpoints.insert(endpoints.begin(), boost::asio::ip::tcp::endpoint());
452
453 result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end());
454 BOOST_ASIO_CHECK(result == cendpoints.begin() + 1);
455}
456
457void test_connect_iter_ec()
458{

Callers

nothing calls this directly

Calls 7

codeMethod · 0.80
target_endpointMethod · 0.80
insertMethod · 0.80
connectFunction · 0.50
endpointClass · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected