[
{ "fn": "parseIpv6", "name": "documentation address with ::", "args": ["2001:db8::1"], "expect": [8193, 3512, 0, 0, 0, 0, 0, 1] },
{ "fn": "parseIpv6", "name": "the unspecified address is all zeros", "args": ["::"], "expect": [0, 0, 0, 0, 0, 0, 0, 0] },
{ "fn": "parseIpv6", "name": "loopback", "args": ["::1"], "expect": [0, 0, 0, 0, 0, 0, 0, 1] },
{ "fn": "parseIpv6", "name": ":: at the end", "args": ["fe80::"], "expect": [65152, 0, 0, 0, 0, 0, 0, 0] },
{ "fn": "parseIpv6", "name": "full form, upper case and leading zeros", "args": ["2001:0DB8:0000:0000:0000:ff00:0042:8329"], "expect": [8193, 3512, 0, 0, 0, 65280, 66, 33577] },
{ "fn": "parseIpv6", "name": "IPv4-mapped with a dotted tail: 192.0 is c000, 2.128 is 0280", "args": ["::ffff:192.0.2.128"], "expect": [0, 0, 0, 0, 0, 65535, 49152, 640] },
{ "fn": "parseIpv6", "name": "NAT64 well-known prefix with a dotted tail", "args": ["64:ff9b::192.0.2.33"], "expect": [100, 65435, 0, 0, 0, 0, 49152, 545] },
{ "fn": "parseIpv6", "name": "six groups and a dotted tail without ::", "args": ["1:2:3:4:5:6:1.2.3.4"], "expect": [1, 2, 3, 4, 5, 6, 258, 772] },
{ "fn": "parseIpv6", "name": "seven groups and :: standing for one zero group", "args": ["1:2:3:4:5:6:7::"], "expect": [1, 2, 3, 4, 5, 6, 7, 0] },
{ "fn": "parseIpv6", "name": "two :: are ambiguous", "args": ["2001:db8::1::1"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "nine groups", "args": ["1:2:3:4:5:6:7:8:9"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "seven groups without ::", "args": ["1:2:3:4:5:6:7"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "eight groups and :: (:: must stand for at least one)", "args": ["1:2:3:4:5:6:7:8::"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "a five-digit group", "args": ["12345::"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "a zone id is not part of the address", "args": ["fe80::1%eth0"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "a prefix length is not part of the address", "args": ["2001:db8::/32"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "a dotted part that is not last", "args": ["::192.0.2.1:1"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "the dotted tail follows the IPv4 rules (no leading zeros)", "args": ["::ffff:01.2.3.4"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "a single leading colon", "args": [":1::"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "a trailing newline", "args": ["::1\n"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "a non-ASCII digit", "args": ["١::1"], "expectError": "is not an IPv6 address" },
{ "fn": "parseIpv6", "name": "empty text", "args": [""], "expectError": "is not an IPv6 address" },
{ "fn": "formatIpv6", "name": "compresses the zero run", "args": [[8193, 3512, 0, 0, 0, 0, 0, 1]], "expect": "2001:db8::1" },
{ "fn": "formatIpv6", "name": "all zeros is ::", "args": [[0, 0, 0, 0, 0, 0, 0, 0]], "expect": "::" },
{ "fn": "formatIpv6", "name": "loopback", "args": [[0, 0, 0, 0, 0, 0, 0, 1]], "expect": "::1" },
{ "fn": "formatIpv6", "name": "a run at the end", "args": [[65152, 0, 0, 0, 0, 0, 0, 0]], "expect": "fe80::" },
{ "fn": "formatIpv6", "name": "the longest run wins, not the first (RFC 5952 4.2.3)", "args": [[8193, 3512, 0, 1, 0, 0, 0, 1]], "expect": "2001:db8:0:1::1" },
{ "fn": "formatIpv6", "name": "equal runs: the first is compressed", "args": [[8193, 3512, 0, 0, 1, 0, 0, 1]], "expect": "2001:db8::1:0:0:1" },
{ "fn": "formatIpv6", "name": "equal runs at both ends: the first", "args": [[0, 0, 1, 2, 3, 4, 0, 0]], "expect": "::1:2:3:4:0:0" },
{ "fn": "formatIpv6", "name": "a single zero group is never :: (RFC 5952 4.2.2)", "args": [[8193, 3512, 0, 1, 1, 1, 1, 1]], "expect": "2001:db8:0:1:1:1:1:1" },
{ "fn": "formatIpv6", "name": "lower case, leading zeros dropped", "args": [[8193, 3512, 0, 0, 0, 65280, 66, 33577]], "expect": "2001:db8::ff00:42:8329" },
{ "fn": "formatIpv6", "name": "IPv4-mapped keeps a dotted tail (RFC 5952 5)", "args": [[0, 0, 0, 0, 0, 65535, 49152, 640]], "expect": "::ffff:192.0.2.128" },
{ "fn": "formatIpv6", "name": "not mapped (a non-zero fifth group): plain hex", "args": [[0, 0, 0, 0, 1, 65535, 49152, 640]], "expect": "::1:ffff:c000:280" },
{ "fn": "formatIpv6", "name": "seven groups", "args": [[1, 2, 3, 4, 5, 6, 7]], "expectError": "IPv6 groups must be eight integers from 0 to 65535" },
{ "fn": "formatIpv6", "name": "a group above 65535", "args": [[65536, 0, 0, 0, 0, 0, 0, 0]], "expectError": "IPv6 groups must be eight integers from 0 to 65535" },
{ "fn": "formatIpv6", "name": "a negative group", "args": [[0, 0, 0, 0, 0, 0, 0, -1]], "expectError": "IPv6 groups must be eight integers from 0 to 65535" },
{ "fn": "formatIpv6", "name": "a fractional group", "args": [[0, 0, 0, 0, 0, 0, 0, 1.5]], "expectError": "IPv6 groups must be eight integers from 0 to 65535" },
{ "fn": "isIpv6", "name": "loopback", "args": ["::1"], "expect": true },
{ "fn": "isIpv6", "name": "documentation address", "args": ["2001:db8::1"], "expect": true },
{ "fn": "isIpv6", "name": "IPv4-mapped", "args": ["::ffff:192.0.2.1"], "expect": true },
{ "fn": "isIpv6", "name": "upper case", "args": ["FE80::1"], "expect": true },
{ "fn": "isIpv6", "name": "a zone id", "args": ["fe80::1%eth0"], "expect": false },
{ "fn": "isIpv6", "name": "an IPv4 address", "args": ["1.2.3.4"], "expect": false },
{ "fn": "isIpv6", "name": "a trailing newline", "args": ["::1\n"], "expect": false },
{ "fn": "isIpv6", "name": "three colons", "args": ["2001:db8:::1"], "expect": false },
{ "fn": "isIpv6", "name": "two ::", "args": ["1::2::3"], "expect": false },
{ "fn": "isIpv6", "name": "empty text", "args": [""], "expect": false }
]