Make unit tests work when ASIO_NO_DEPRECATED is defined.
This commit is contained in:
parent
7ea623bbc4
commit
7b8815ea41
@ -69,14 +69,18 @@ void test()
|
||||
(void)addr_v6_value;
|
||||
|
||||
std::string string_value = addr1.to_string();
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
string_value = addr1.to_string(ec);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// address static functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
addr1 = ip::address::from_string("127.0.0.1");
|
||||
addr1 = ip::address::from_string("127.0.0.1", ec);
|
||||
addr1 = ip::address::from_string(string_value);
|
||||
addr1 = ip::address::from_string(string_value, ec);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// address comparisons.
|
||||
|
||||
|
@ -53,6 +53,7 @@ void test()
|
||||
b = addr1.is_unspecified();
|
||||
(void)b;
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
b = addr1.is_class_a();
|
||||
(void)b;
|
||||
|
||||
@ -61,6 +62,7 @@ void test()
|
||||
|
||||
b = addr1.is_class_c();
|
||||
(void)b;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
b = addr1.is_multicast();
|
||||
(void)b;
|
||||
@ -68,18 +70,27 @@ void test()
|
||||
ip::address_v4::bytes_type bytes_value = addr1.to_bytes();
|
||||
(void)bytes_value;
|
||||
|
||||
ip::address_v4::uint_type uint_value = addr1.to_uint();
|
||||
(void)uint_value;
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
unsigned long ulong_value = addr1.to_ulong();
|
||||
(void)ulong_value;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
std::string string_value = addr1.to_string();
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
string_value = addr1.to_string(ec);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// address_v4 static functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
addr1 = ip::address_v4::from_string("127.0.0.1");
|
||||
addr1 = ip::address_v4::from_string("127.0.0.1", ec);
|
||||
addr1 = ip::address_v4::from_string(string_value);
|
||||
addr1 = ip::address_v4::from_string(string_value, ec);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
addr1 = ip::address_v4::any();
|
||||
|
||||
@ -87,9 +98,11 @@ void test()
|
||||
|
||||
addr1 = ip::address_v4::broadcast();
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
addr1 = ip::address_v4::broadcast(addr2, addr3);
|
||||
|
||||
addr1 = ip::address_v4::netmask(addr2);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// address_v4 comparisons.
|
||||
|
||||
@ -155,7 +168,10 @@ void test()
|
||||
ASIO_CHECK(a1.to_bytes()[1] == 0);
|
||||
ASIO_CHECK(a1.to_bytes()[2] == 0);
|
||||
ASIO_CHECK(a1.to_bytes()[3] == 0);
|
||||
ASIO_CHECK(a1.to_uint() == 0);
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(a1.to_ulong() == 0);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
address_v4::bytes_type b1 = {{ 1, 2, 3, 4 }};
|
||||
address_v4 a2(b1);
|
||||
@ -163,17 +179,26 @@ void test()
|
||||
ASIO_CHECK(a2.to_bytes()[1] == 2);
|
||||
ASIO_CHECK(a2.to_bytes()[2] == 3);
|
||||
ASIO_CHECK(a2.to_bytes()[3] == 4);
|
||||
ASIO_CHECK(((a2.to_uint() >> 24) & 0xFF) == b1[0]);
|
||||
ASIO_CHECK(((a2.to_uint() >> 16) & 0xFF) == b1[1]);
|
||||
ASIO_CHECK(((a2.to_uint() >> 8) & 0xFF) == b1[2]);
|
||||
ASIO_CHECK((a2.to_uint() & 0xFF) == b1[3]);
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(((a2.to_ulong() >> 24) & 0xFF) == b1[0]);
|
||||
ASIO_CHECK(((a2.to_ulong() >> 16) & 0xFF) == b1[1]);
|
||||
ASIO_CHECK(((a2.to_ulong() >> 8) & 0xFF) == b1[2]);
|
||||
ASIO_CHECK((a2.to_ulong() & 0xFF) == b1[3]);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
address_v4 a3(0x01020304);
|
||||
ASIO_CHECK(a3.to_bytes()[0] == 1);
|
||||
ASIO_CHECK(a3.to_bytes()[1] == 2);
|
||||
ASIO_CHECK(a3.to_bytes()[2] == 3);
|
||||
ASIO_CHECK(a3.to_bytes()[3] == 4);
|
||||
ASIO_CHECK(a3.to_uint() == 0x01020304);
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(a3.to_ulong() == 0x01020304);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ASIO_CHECK(address_v4(0x7F000001).is_loopback());
|
||||
ASIO_CHECK(address_v4(0x7F000002).is_loopback());
|
||||
@ -184,6 +209,7 @@ void test()
|
||||
ASIO_CHECK(!address_v4(0x7F000001).is_unspecified());
|
||||
ASIO_CHECK(!address_v4(0x01020304).is_unspecified());
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(address_v4(0x01000000).is_class_a());
|
||||
ASIO_CHECK(address_v4(0x7F000000).is_class_a());
|
||||
ASIO_CHECK(!address_v4(0x80000000).is_class_a());
|
||||
@ -216,6 +242,7 @@ void test()
|
||||
ASIO_CHECK(!address_v4(0xEFFFFFFF).is_class_c());
|
||||
ASIO_CHECK(!address_v4(0xF0000000).is_class_c());
|
||||
ASIO_CHECK(!address_v4(0xFFFFFFFF).is_class_c());
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ASIO_CHECK(!address_v4(0x01000000).is_multicast());
|
||||
ASIO_CHECK(!address_v4(0x7F000000).is_multicast());
|
||||
@ -233,22 +260,32 @@ void test()
|
||||
ASIO_CHECK(a4.to_bytes()[1] == 0);
|
||||
ASIO_CHECK(a4.to_bytes()[2] == 0);
|
||||
ASIO_CHECK(a4.to_bytes()[3] == 0);
|
||||
ASIO_CHECK(a4.to_uint() == 0);
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(a4.to_ulong() == 0);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
address_v4 a5 = address_v4::loopback();
|
||||
ASIO_CHECK(a5.to_bytes()[0] == 0x7F);
|
||||
ASIO_CHECK(a5.to_bytes()[1] == 0);
|
||||
ASIO_CHECK(a5.to_bytes()[2] == 0);
|
||||
ASIO_CHECK(a5.to_bytes()[3] == 0x01);
|
||||
ASIO_CHECK(a5.to_uint() == 0x7F000001);
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(a5.to_ulong() == 0x7F000001);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
address_v4 a6 = address_v4::broadcast();
|
||||
ASIO_CHECK(a6.to_bytes()[0] == 0xFF);
|
||||
ASIO_CHECK(a6.to_bytes()[1] == 0xFF);
|
||||
ASIO_CHECK(a6.to_bytes()[2] == 0xFF);
|
||||
ASIO_CHECK(a6.to_bytes()[3] == 0xFF);
|
||||
ASIO_CHECK(a6.to_uint() == 0xFFFFFFFF);
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(a6.to_ulong() == 0xFFFFFFFF);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
address_v4 class_a_net(0xFF000000);
|
||||
address_v4 class_b_net(0xFFFF0000);
|
||||
address_v4 class_c_net(0xFFFFFF00);
|
||||
@ -263,6 +300,7 @@ void test()
|
||||
ASIO_CHECK(address_v4::netmask(address_v4(0xEFFFFFFF)) == other_net);
|
||||
ASIO_CHECK(address_v4::netmask(address_v4(0xF0000000)) == other_net);
|
||||
ASIO_CHECK(address_v4::netmask(address_v4(0xFFFFFFFF)) == other_net);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
}
|
||||
|
||||
} // namespace ip_address_v4_runtime
|
||||
|
@ -66,8 +66,10 @@ void test()
|
||||
b = addr1.is_v4_mapped();
|
||||
(void)b;
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
b = addr1.is_v4_compatible();
|
||||
(void)b;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
b = addr1.is_multicast_node_local();
|
||||
(void)b;
|
||||
@ -88,24 +90,32 @@ void test()
|
||||
(void)bytes_value;
|
||||
|
||||
std::string string_value = addr1.to_string();
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
string_value = addr1.to_string(ec);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ip::address_v4 addr3 = addr1.to_v4();
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// address_v6 static functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
addr1 = ip::address_v6::from_string("0::0");
|
||||
addr1 = ip::address_v6::from_string("0::0", ec);
|
||||
addr1 = ip::address_v6::from_string(string_value);
|
||||
addr1 = ip::address_v6::from_string(string_value, ec);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
addr1 = ip::address_v6::any();
|
||||
|
||||
addr1 = ip::address_v6::loopback();
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
addr1 = ip::address_v6::v4_mapped(addr3);
|
||||
|
||||
addr1 = ip::address_v6::v4_compatible(addr3);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// address_v6 comparisons.
|
||||
|
||||
@ -136,6 +146,9 @@ void test()
|
||||
addr1 = ip::make_address_v6(string_value, ec);
|
||||
|
||||
// address_v6 IPv4-mapped conversion.
|
||||
#if defined(ASIO_NO_DEPRECATED)
|
||||
ip::address_v4 addr3;
|
||||
#endif // defined(ASIO_NO_DEPRECATED)
|
||||
addr1 = ip::make_address_v6(ip::v4_mapped, addr3);
|
||||
addr3 = ip::make_address_v4(ip::v4_mapped, addr1);
|
||||
|
||||
@ -286,6 +299,7 @@ void test()
|
||||
ASIO_CHECK(!mcast_org_local_address.is_v4_mapped());
|
||||
ASIO_CHECK(!mcast_site_local_address.is_v4_mapped());
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
ASIO_CHECK(!unspecified_address.is_v4_compatible());
|
||||
ASIO_CHECK(!loopback_address.is_v4_compatible());
|
||||
ASIO_CHECK(!link_local_address.is_v4_compatible());
|
||||
@ -297,6 +311,7 @@ void test()
|
||||
ASIO_CHECK(!mcast_node_local_address.is_v4_compatible());
|
||||
ASIO_CHECK(!mcast_org_local_address.is_v4_compatible());
|
||||
ASIO_CHECK(!mcast_site_local_address.is_v4_compatible());
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ASIO_CHECK(!unspecified_address.is_multicast());
|
||||
ASIO_CHECK(!loopback_address.is_multicast());
|
||||
|
@ -118,8 +118,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = socket1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::icmp::socket::executor_type ex = socket1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_socket functions.
|
||||
|
||||
@ -552,8 +557,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = resolver.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::icmp::resolver::executor_type ex = resolver.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_resolver functions.
|
||||
|
||||
|
@ -117,26 +117,26 @@ void test()
|
||||
ASIO_CHECK(msg == std::string("prefix length too large"));
|
||||
|
||||
// construct address range from address and prefix length
|
||||
ASIO_CHECK(network_v6(address_v6::from_string("2001:370::10:7344"), 128).network() == address_v6::from_string("2001:370::10:7344"));
|
||||
ASIO_CHECK(network_v6(address_v6::from_string("2001:370::10:7344"), 64).network() == address_v6::from_string("2001:370::"));
|
||||
ASIO_CHECK(network_v6(address_v6::from_string("2001:370::10:7344"), 27).network() == address_v6::from_string("2001:360::"));
|
||||
ASIO_CHECK(network_v6(make_address_v6("2001:370::10:7344"), 128).network() == make_address_v6("2001:370::10:7344"));
|
||||
ASIO_CHECK(network_v6(make_address_v6("2001:370::10:7344"), 64).network() == make_address_v6("2001:370::"));
|
||||
ASIO_CHECK(network_v6(make_address_v6("2001:370::10:7344"), 27).network() == make_address_v6("2001:360::"));
|
||||
|
||||
// construct address range from string in CIDR notation
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/128").network() == address_v6::from_string("2001:370::10:7344"));
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/64").network() == address_v6::from_string("2001:370::"));
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/27").network() == address_v6::from_string("2001:360::"));
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/128").network() == make_address_v6("2001:370::10:7344"));
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/64").network() == make_address_v6("2001:370::"));
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/27").network() == make_address_v6("2001:360::"));
|
||||
|
||||
// prefix length
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/128").prefix_length() == 128);
|
||||
ASIO_CHECK(network_v6(address_v6::from_string("2001:370::10:7344"), 27).prefix_length() == 27);
|
||||
ASIO_CHECK(network_v6(make_address_v6("2001:370::10:7344"), 27).prefix_length() == 27);
|
||||
|
||||
// to string
|
||||
std::string a("2001:370::10:7344/64");
|
||||
ASIO_CHECK(make_network_v6(a.c_str()).to_string() == a);
|
||||
ASIO_CHECK(network_v6(address_v6::from_string("2001:370::10:7344"), 27).to_string() == std::string("2001:370::10:7344/27"));
|
||||
ASIO_CHECK(network_v6(make_address_v6("2001:370::10:7344"), 27).to_string() == std::string("2001:370::10:7344/27"));
|
||||
|
||||
// return host part
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/64").address() == address_v6::from_string("2001:370::10:7344"));
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/64").address() == make_address_v6("2001:370::10:7344"));
|
||||
ASIO_CHECK(make_network_v6("2001:370::10:7344/27").address().to_string() == "2001:370::10:7344");
|
||||
|
||||
// return network in CIDR notation
|
||||
@ -163,27 +163,27 @@ void test()
|
||||
network_v6 net15(make_network_v6("2001:0db8::/119"));
|
||||
|
||||
// network
|
||||
ASIO_CHECK(net12.network() == address_v6::from_string("2001:370::"));
|
||||
ASIO_CHECK(net13.network() == address_v6::from_string("2001:0db8::"));
|
||||
ASIO_CHECK(net14.network() == address_v6::from_string("2001:0db8::"));
|
||||
ASIO_CHECK(net15.network() == address_v6::from_string("2001:0db8::"));
|
||||
ASIO_CHECK(net12.network() == make_address_v6("2001:370::"));
|
||||
ASIO_CHECK(net13.network() == make_address_v6("2001:0db8::"));
|
||||
ASIO_CHECK(net14.network() == make_address_v6("2001:0db8::"));
|
||||
ASIO_CHECK(net15.network() == make_address_v6("2001:0db8::"));
|
||||
|
||||
// iterator
|
||||
//ASIO_CHECK(std::distance(net12.hosts().begin(),net12.hosts().end()) == 18446744073709552000);
|
||||
ASIO_CHECK(std::distance(net13.hosts().begin(),net13.hosts().end()) == 2);
|
||||
ASIO_CHECK(std::distance(net14.hosts().begin(),net14.hosts().end()) == 8);
|
||||
ASIO_CHECK(std::distance(net15.hosts().begin(),net15.hosts().end()) == 512);
|
||||
ASIO_CHECK(*net12.hosts().begin() == address_v6::from_string("2001:0370::"));
|
||||
ASIO_CHECK(net12.hosts().end() != net12.hosts().find(address_v6::from_string("2001:0370::ffff:ffff:ffff:ffff")));
|
||||
ASIO_CHECK(*net13.hosts().begin() == address_v6::from_string("2001:0db8::"));
|
||||
ASIO_CHECK(net13.hosts().end() != net13.hosts().find(address_v6::from_string("2001:0db8::1")));
|
||||
ASIO_CHECK(net13.hosts().end() == net13.hosts().find(address_v6::from_string("2001:0db8::2")));
|
||||
ASIO_CHECK(*net14.hosts().begin() == address_v6::from_string("2001:0db8::"));
|
||||
ASIO_CHECK(net14.hosts().end() != net14.hosts().find(address_v6::from_string("2001:0db8::7")));
|
||||
ASIO_CHECK(net14.hosts().end() == net14.hosts().find(address_v6::from_string("2001:0db8::8")));
|
||||
ASIO_CHECK(*net15.hosts().begin() == address_v6::from_string("2001:0db8::"));
|
||||
ASIO_CHECK(net15.hosts().end() != net15.hosts().find(address_v6::from_string("2001:0db8::01ff")));
|
||||
ASIO_CHECK(net15.hosts().end() == net15.hosts().find(address_v6::from_string("2001:0db8::0200")));
|
||||
ASIO_CHECK(*net12.hosts().begin() == make_address_v6("2001:0370::"));
|
||||
ASIO_CHECK(net12.hosts().end() != net12.hosts().find(make_address_v6("2001:0370::ffff:ffff:ffff:ffff")));
|
||||
ASIO_CHECK(*net13.hosts().begin() == make_address_v6("2001:0db8::"));
|
||||
ASIO_CHECK(net13.hosts().end() != net13.hosts().find(make_address_v6("2001:0db8::1")));
|
||||
ASIO_CHECK(net13.hosts().end() == net13.hosts().find(make_address_v6("2001:0db8::2")));
|
||||
ASIO_CHECK(*net14.hosts().begin() == make_address_v6("2001:0db8::"));
|
||||
ASIO_CHECK(net14.hosts().end() != net14.hosts().find(make_address_v6("2001:0db8::7")));
|
||||
ASIO_CHECK(net14.hosts().end() == net14.hosts().find(make_address_v6("2001:0db8::8")));
|
||||
ASIO_CHECK(*net15.hosts().begin() == make_address_v6("2001:0db8::"));
|
||||
ASIO_CHECK(net15.hosts().end() != net15.hosts().find(make_address_v6("2001:0db8::01ff")));
|
||||
ASIO_CHECK(net15.hosts().end() == net15.hosts().find(make_address_v6("2001:0db8::0200")));
|
||||
}
|
||||
|
||||
} // namespace ip_network_v6_runtime
|
||||
|
@ -266,8 +266,10 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = socket1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::tcp::socket::executor_type ex = socket1.get_executor();
|
||||
(void)ex;
|
||||
@ -837,8 +839,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = acceptor1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::tcp::acceptor::executor_type ex = acceptor1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_socket_acceptor functions.
|
||||
|
||||
@ -1090,8 +1097,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = resolver.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::tcp::resolver::executor_type ex = resolver.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_resolver functions.
|
||||
|
||||
|
@ -134,8 +134,10 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = socket1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::udp::socket::executor_type ex = socket1.get_executor();
|
||||
(void)ex;
|
||||
@ -653,8 +655,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = resolver.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::udp::resolver::executor_type ex = resolver.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_resolver functions.
|
||||
|
||||
|
@ -65,7 +65,8 @@ public:
|
||||
void async_write(const Const_Buffers&, Handler handler)
|
||||
{
|
||||
asio::error_code error;
|
||||
io_context_.post(asio::detail::bind_handler(handler, error, 0));
|
||||
asio::post(io_context_,
|
||||
asio::detail::bind_handler(handler, error, 0));
|
||||
}
|
||||
|
||||
template <typename Mutable_Buffers>
|
||||
@ -85,7 +86,8 @@ public:
|
||||
void async_read(const Mutable_Buffers&, Handler handler)
|
||||
{
|
||||
asio::error_code error;
|
||||
io_context_.post(asio::detail::bind_handler(handler, error, 0));
|
||||
asio::post(io_context_,
|
||||
asio::detail::bind_handler(handler, error, 0));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -65,7 +65,8 @@ public:
|
||||
void async_write(const Const_Buffers&, Handler handler)
|
||||
{
|
||||
asio::error_code error;
|
||||
io_context_.post(asio::detail::bind_handler(handler, error, 0));
|
||||
asio::post(io_context_,
|
||||
asio::detail::bind_handler(handler, error, 0));
|
||||
}
|
||||
|
||||
template <typename Mutable_Buffers>
|
||||
@ -85,7 +86,8 @@ public:
|
||||
void async_read(const Mutable_Buffers&, Handler handler)
|
||||
{
|
||||
asio::error_code error;
|
||||
io_context_.post(asio::detail::bind_handler(handler, error, 0));
|
||||
asio::post(io_context_,
|
||||
asio::detail::bind_handler(handler, error, 0));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -69,8 +69,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = socket1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
dp::socket::executor_type ex = socket1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_socket functions.
|
||||
|
||||
|
@ -77,8 +77,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = socket1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
sp::socket::executor_type ex = socket1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_socket functions.
|
||||
|
||||
|
@ -76,8 +76,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = descriptor1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
posix::stream_descriptor::executor_type ex = descriptor1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_descriptor functions.
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <sstream>
|
||||
#include "asio/io_context.hpp"
|
||||
#include "asio/dispatch.hpp"
|
||||
#include "asio/post.hpp"
|
||||
#include "asio/thread.hpp"
|
||||
#include "unit_test.hpp"
|
||||
@ -61,7 +62,7 @@ void increment_without_lock(io_context::strand* s, int* count)
|
||||
|
||||
int original_count = *count;
|
||||
|
||||
s->dispatch(bindns::bind(increment, count));
|
||||
dispatch(*s, bindns::bind(increment, count));
|
||||
|
||||
// No other functions are currently executing through the locking dispatcher,
|
||||
// so the previous call to dispatch should have successfully nested.
|
||||
@ -74,7 +75,7 @@ void increment_with_lock(io_context::strand* s, int* count)
|
||||
|
||||
int original_count = *count;
|
||||
|
||||
s->dispatch(bindns::bind(increment, count));
|
||||
dispatch(*s, bindns::bind(increment, count));
|
||||
|
||||
// The current function already holds the strand's lock, so the
|
||||
// previous call to dispatch should have successfully nested.
|
||||
@ -96,9 +97,9 @@ void start_sleep_increments(io_context* ioc, io_context::strand* s, int* count)
|
||||
t.wait();
|
||||
|
||||
// Start three increments.
|
||||
s->post(bindns::bind(sleep_increment, ioc, count));
|
||||
s->post(bindns::bind(sleep_increment, ioc, count));
|
||||
s->post(bindns::bind(sleep_increment, ioc, count));
|
||||
post(*s, bindns::bind(sleep_increment, ioc, count));
|
||||
post(*s, bindns::bind(sleep_increment, ioc, count));
|
||||
post(*s, bindns::bind(sleep_increment, ioc, count));
|
||||
}
|
||||
|
||||
void throw_exception()
|
||||
|
@ -65,8 +65,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = handle1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
io_context::executor_type ex = handle1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_handle functions.
|
||||
|
||||
|
@ -72,8 +72,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = handle1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
io_context::executor_type ex = handle1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_handle functions.
|
||||
|
||||
|
@ -71,8 +71,13 @@ void test()
|
||||
|
||||
// basic_io_object functions.
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
io_context& ioc_ref = handle1.get_io_context();
|
||||
(void)ioc_ref;
|
||||
#endif !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
io_context::executor_type ex = handle1.get_executor();
|
||||
(void)ex;
|
||||
|
||||
// basic_handle functions.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user