diff --git a/src/or/test.c b/src/or/test.c index 29b6d5c097..610a297f1a 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -1024,6 +1024,16 @@ _test_eq_ip6(struct in6_addr *a, struct in6_addr *b, const char *e1, test_eq_ip6(&a1, &a2); \ } while (0) +#define test_ntop6_reduces2(a,b,c) do { \ + r = tor_inet_pton(AF_INET6, a, &a1); \ + test_assert(r==1); \ + test_assert(tor_inet_ntop(AF_INET6, &a1, buf, sizeof(buf))); \ + test_assert(!strcmp(buf, b) || !strcmp(buf, c)); \ + r = tor_inet_pton(AF_INET6, b, &a2); \ + test_assert(r==1); \ + test_eq_ip6(&a1, &a2); \ + } while (0) + static void test_ip6_helpers(void) { @@ -1060,8 +1070,8 @@ test_ip6_helpers(void) /* === Test ntop: af_inet6 */ test_ntop6_reduces("0:0:0:0:0:0:0:0", "::"); - test_ntop6_reduces("0001:0099:BEEF:0000:0123:FFFF:0001:0001", - "1:99:beef:0:123:ffff:1:1"); + test_ntop6_reduces("0001:0099:BEEF:0006:0123:FFFF:0001:0001", + "1:99:beef:6:123:ffff:1:1"); test_ntop6_reduces("0:0:0:0:0:0:c0a8:0101", "::192.168.1.1"); test_ntop6_reduces("0:0:0:0:0:ffff:c0a8:0101", "::ffff:192.168.1.1");