diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-06-01 00:06:45 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-06-01 00:06:45 +0000 |
commit | 6bb65fa3713873b9e18a297426780b737cc2b0ce (patch) | |
tree | 74c37158a73e540fca2424947c995ca72cd1b602 /src/or | |
parent | d8a1f31283e575e4ec28afc070d784c8e83599c2 (diff) | |
download | tor-6bb65fa3713873b9e18a297426780b737cc2b0ce.tar tor-6bb65fa3713873b9e18a297426780b737cc2b0ce.tar.gz |
r13121@catbus: nickm | 2007-05-31 20:06:40 -0400
Oops. Different inet_ntop implementations seem to differ on whether, in an IPv6 address with a single "0" word, that word should be written as 0, or omitted. Fix the unit tests to account for that.
svn:r10432
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/test.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/test.c b/src/or/test.c index 29b6d5c09..610a297f1 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"); |