Commit c269e25a authored by Joseph Noir's avatar Joseph Noir

Fix ip test and formatting

parent a35f9d72
......@@ -217,9 +217,9 @@ std::vector<ip_address> local_addresses(string_view host) {
std::vector<ip_address> local_addresses(string_view host) {
if (!host.empty() && host.compare(v4_any_addr) == 0)
return { ip_address{ make_ipv4_address(0, 0, 0, 0) } };
return {ip_address{make_ipv4_address(0, 0, 0, 0)}};
if (!host.empty() && host.compare(v6_any_addr) == 0)
return { ip_address{} };
return {ip_address{}};
ifaddrs* tmp = nullptr;
if (getifaddrs(&tmp) != 0)
return {};
......
......@@ -35,7 +35,7 @@ namespace {
struct fixture : host_fixture {
fixture() : v6_local{{0}, {0x1}} {
v4_local = ip_address{make_ipv4_address(127, 0, 0, 1)};
v4_any_addr = ip_address{ make_ipv4_address(0, 0, 0, 0) };
v4_any_addr = ip_address{make_ipv4_address(0, 0, 0, 0)};
}
bool contains(ip_address x) {
......@@ -83,7 +83,7 @@ CAF_TEST(local addresses) {
CAF_MESSAGE("check: localhost");
addrs = ip::local_addresses("localhost");
CAF_CHECK(!addrs.empty());
CAF_CHECK(contains(v4_local) && contains(v6_local));
CAF_CHECK(contains(v4_local) || contains(v6_local));
}
CAF_TEST_FIXTURE_SCOPE_END()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment