diff options
-rw-r--r-- | auto_tests/network_test.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/auto_tests/network_test.c b/auto_tests/network_test.c index 4713528d..106f5f6a 100644 --- a/auto_tests/network_test.c +++ b/auto_tests/network_test.c | |||
@@ -15,6 +15,10 @@ | |||
15 | 15 | ||
16 | #include "helpers.h" | 16 | #include "helpers.h" |
17 | 17 | ||
18 | #ifndef USE_IPV6 | ||
19 | #define USE_IPV6 1 | ||
20 | #endif | ||
21 | |||
18 | START_TEST(test_addr_resolv_localhost) | 22 | START_TEST(test_addr_resolv_localhost) |
19 | { | 23 | { |
20 | #ifdef __CYGWIN__ | 24 | #ifdef __CYGWIN__ |
@@ -69,6 +73,7 @@ START_TEST(test_addr_resolv_localhost) | |||
69 | res = addr_resolve(localhost, &ip, &extra); | 73 | res = addr_resolve(localhost, &ip, &extra); |
70 | ck_assert_msg(res > 0, "Resolver failed: %u, %s (%x, %x)", errno, strerror(errno)); | 74 | ck_assert_msg(res > 0, "Resolver failed: %u, %s (%x, %x)", errno, strerror(errno)); |
71 | 75 | ||
76 | #if USE_IPV6 | ||
72 | ck_assert_msg(ip.family == TOX_AF_INET6, "Expected family TOX_AF_INET6 (%u), got %u.", TOX_AF_INET6, ip.family); | 77 | ck_assert_msg(ip.family == TOX_AF_INET6, "Expected family TOX_AF_INET6 (%u), got %u.", TOX_AF_INET6, ip.family); |
73 | ck_assert_msg(!memcmp(&ip.ip6, &ip6_loopback, sizeof(IP6)), "Expected ::1, got %s.", | 78 | ck_assert_msg(!memcmp(&ip.ip6, &ip6_loopback, sizeof(IP6)), "Expected ::1, got %s.", |
74 | ip_ntoa(&ip, ip_str, sizeof(ip_str))); | 79 | ip_ntoa(&ip, ip_str, sizeof(ip_str))); |
@@ -76,6 +81,11 @@ START_TEST(test_addr_resolv_localhost) | |||
76 | ck_assert_msg(extra.family == TOX_AF_INET, "Expected family TOX_AF_INET (%u), got %u.", TOX_AF_INET, extra.family); | 81 | ck_assert_msg(extra.family == TOX_AF_INET, "Expected family TOX_AF_INET (%u), got %u.", TOX_AF_INET, extra.family); |
77 | ck_assert_msg(extra.ip4.uint32 == loopback, "Expected 127.0.0.1, got %s.", | 82 | ck_assert_msg(extra.ip4.uint32 == loopback, "Expected 127.0.0.1, got %s.", |
78 | ip_ntoa(&ip, ip_str, sizeof(ip_str))); | 83 | ip_ntoa(&ip, ip_str, sizeof(ip_str))); |
84 | #else | ||
85 | ck_assert_msg(ip.family == TOX_AF_INET, "Expected family TOX_AF_INET (%u), got %u.", TOX_AF_INET, ip.family); | ||
86 | ck_assert_msg(ip.ip4.uint32 == loopback, "Expected 127.0.0.1, got %s.", | ||
87 | ip_ntoa(&ip, ip_str, sizeof(ip_str))); | ||
88 | #endif | ||
79 | } | 89 | } |
80 | END_TEST | 90 | END_TEST |
81 | 91 | ||