diff options
Diffstat (limited to 'auto_tests/network_test.c')
-rw-r--r-- | auto_tests/network_test.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/auto_tests/network_test.c b/auto_tests/network_test.c index 2ce6d0b5..ea08c1b8 100644 --- a/auto_tests/network_test.c +++ b/auto_tests/network_test.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <check.h> | 5 | #include <check.h> |
6 | #include <errno.h> | ||
6 | #include <stdint.h> | 7 | #include <stdint.h> |
7 | #include <stdlib.h> | 8 | #include <stdlib.h> |
8 | #include <string.h> | 9 | #include <string.h> |
@@ -36,8 +37,9 @@ START_TEST(test_addr_resolv_localhost) | |||
36 | 37 | ||
37 | if (res > 0) { | 38 | if (res > 0) { |
38 | ck_assert_msg(ip.family == AF_INET, "Expected family AF_INET, got %u.", ip.family); | 39 | ck_assert_msg(ip.family == AF_INET, "Expected family AF_INET, got %u.", ip.family); |
39 | ck_assert_msg(ip.ip4.uint32 == htonl(0x7F000001), "Expected 127.0.0.1, got %s.", | 40 | struct in_addr addr; |
40 | inet_ntoa(ip.ip4.in_addr)); | 41 | fill_addr4(ip.ip4, &addr); |
42 | ck_assert_msg(ip.ip4.uint32 == htonl(0x7F000001), "Expected 127.0.0.1, got %s.", inet_ntoa(addr)); | ||
41 | } | 43 | } |
42 | 44 | ||
43 | ip_init(&ip, 1); // ipv6enabled = 1 | 45 | ip_init(&ip, 1); // ipv6enabled = 1 |
@@ -71,8 +73,10 @@ START_TEST(test_addr_resolv_localhost) | |||
71 | ck_assert_msg(!memcmp(&ip.ip6, &in6addr_loopback, sizeof(IP6)), "Expected ::1, got %s.", | 73 | ck_assert_msg(!memcmp(&ip.ip6, &in6addr_loopback, sizeof(IP6)), "Expected ::1, got %s.", |
72 | ip_ntoa(&ip, ip_str, sizeof(ip_str))); | 74 | ip_ntoa(&ip, ip_str, sizeof(ip_str))); |
73 | 75 | ||
76 | struct in_addr addr; | ||
77 | fill_addr4(ip.ip4, &addr); | ||
74 | ck_assert_msg(extra.family == AF_INET, "Expected family AF_INET (%u), got %u.", AF_INET, extra.family); | 78 | ck_assert_msg(extra.family == AF_INET, "Expected family AF_INET (%u), got %u.", AF_INET, extra.family); |
75 | ck_assert_msg(extra.ip4.uint32 == htonl(0x7F000001), "Expected 127.0.0.1, got %s.", inet_ntoa(extra.ip4.in_addr)); | 79 | ck_assert_msg(extra.ip4.uint32 == htonl(0x7F000001), "Expected 127.0.0.1, got %s.", inet_ntoa(addr)); |
76 | } | 80 | } |
77 | } else { | 81 | } else { |
78 | printf("Localhost seems to be split in two.\n"); | 82 | printf("Localhost seems to be split in two.\n"); |