| 761 | } |
| 762 | |
| 763 | void test_async_connect_range() |
| 764 | { |
| 765 | connection_sink sink; |
| 766 | boost::asio::io_context io_context; |
| 767 | boost::asio::ip::tcp::socket socket(io_context); |
| 768 | std::vector<boost::asio::ip::tcp::endpoint> endpoints; |
| 769 | boost::asio::ip::tcp::endpoint result; |
| 770 | boost::system::error_code ec; |
| 771 | |
| 772 | boost::asio::async_connect(socket, endpoints, |
| 773 | bindns::bind(range_handler, _1, _2, &ec, &result)); |
| 774 | io_context.restart(); |
| 775 | io_context.run(); |
| 776 | BOOST_ASIO_CHECK(result == boost::asio::ip::tcp::endpoint()); |
| 777 | BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); |
| 778 | |
| 779 | endpoints.push_back(sink.target_endpoint()); |
| 780 | |
| 781 | boost::asio::async_connect(socket, endpoints, |
| 782 | bindns::bind(range_handler, _1, _2, &ec, &result)); |
| 783 | io_context.restart(); |
| 784 | io_context.run(); |
| 785 | BOOST_ASIO_CHECK(result == endpoints[0]); |
| 786 | BOOST_ASIO_CHECK(!ec); |
| 787 | |
| 788 | endpoints.push_back(sink.target_endpoint()); |
| 789 | |
| 790 | boost::asio::async_connect(socket, endpoints, |
| 791 | bindns::bind(range_handler, _1, _2, &ec, &result)); |
| 792 | io_context.restart(); |
| 793 | io_context.run(); |
| 794 | BOOST_ASIO_CHECK(result == endpoints[0]); |
| 795 | BOOST_ASIO_CHECK(!ec); |
| 796 | |
| 797 | endpoints.insert(endpoints.begin(), boost::asio::ip::tcp::endpoint()); |
| 798 | |
| 799 | boost::asio::async_connect(socket, endpoints, |
| 800 | bindns::bind(range_handler, _1, _2, &ec, &result)); |
| 801 | io_context.restart(); |
| 802 | io_context.run(); |
| 803 | BOOST_ASIO_CHECK(result == endpoints[1]); |
| 804 | BOOST_ASIO_CHECK(!ec); |
| 805 | |
| 806 | boost::asio::async_connect(socket, endpoints)( |
| 807 | bindns::bind(range_handler, _1, _2, &ec, &result)); |
| 808 | io_context.restart(); |
| 809 | io_context.run(); |
| 810 | BOOST_ASIO_CHECK(result == endpoints[1]); |
| 811 | BOOST_ASIO_CHECK(!ec); |
| 812 | } |
| 813 | |
| 814 | void test_async_connect_range_cond() |
| 815 | { |
nothing calls this directly
no test coverage detected