diff --git a/docs/example-parsers-ip-address.html b/docs/example-parsers-ip-address.html
new file mode 100644
index 00000000..370ab4f4
--- /dev/null
+++ b/docs/example-parsers-ip-address.html
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+ NOTE!
+
+
+
+
Demo
+
Toggle parsed values
+
+
+
+
+
+ Name
+ IPv4
+ IPv6
+
+
+
+ Fred 1.2.3.4 f0f0::1
+ Ginger 1.1.1.1 f0::1
+ Mike 2.222.33.44 1:2:3:4:5::7:8
+ George 255.255.255.255 ::2:3:4
+ Harry 251.2.33.4 f0f0:f::1
+ Frank 251.002.31.4 ::
+ Kristy 2.221.003.4 0:0:0:0:0:0:0:0
+ Lily 251.02.32.4 f0f0::f:1
+ Maria 1.2.3.44 1:2:3:4:5:6:1.2.3.4
+
+
+
+
+
+
Page Header
+
+
<!-- tablesorter -->
+<link rel="stylesheet" href="../css/theme.blue.css">
+<script src="../js/jquery.tablesorter.js"></script>
+
+<!-- load ipv6 parser -->
+<script src="../js/parsers/parser-ipv6.js"></script>
+<script>
+$(function() {
+
+ $('table').tablesorter({
+ theme: 'blue',
+ widgets: ['zebra'],
+ sortList: [[1, 0]],
+ headers: {
+ 1: {
+ sorter: 'ipv6Address'
+ }
+ }
+ });
+
+});
+</script>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/js/parsers/parser-ipv6.js b/js/parsers/parser-ipv6.js
new file mode 100644
index 00000000..121bc37b
--- /dev/null
+++ b/js/parsers/parser-ipv6.js
@@ -0,0 +1,76 @@
+/*! IPv6 Address parser (WIP)
+* IPv6 Address (ffff:0000:0000:0000:0000:0000:0000:0000)
+* needs to support short versions like "::8" or "1:2::7:8"
+* and "::00:192.168.10.184" (embedded IPv4 address)
+* see http://www.intermapper.com/support/tools/IPV6-Validator.aspx
+*/
+/*global jQuery: false */
+;(function($){
+ "use strict";
+
+ var ts = $.tablesorter;
+
+ $.extend( ts.regex, {}, {
+ ipv4Validate : /((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})/,
+ ipv4Extract : /([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/,
+
+ // simplified regex from http://www.intermapper.com/support/tools/IPV6-Validator.aspx
+ // (specifically from http://download.dartware.com/thirdparty/ipv6validator.js)
+ ipv6Validate : /^\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/i
+ });
+
+ ts.addParser({
+ id: "ipv6Address",
+ is: function(s) {
+ return ts.regex.ipv6Validate.test(s);
+ },
+ format: function(address, table) {
+ // code modified from http://forrst.com/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR
+ var i, t, sides, groups, groupsPresent,
+ hex = table ? (typeof table === "boolean" ? table : table && table.config.ipv6HexFormat || false) : false,
+ fullAddress = '',
+ expandedAddress = '',
+ validGroupCount = 8,
+ validGroupSize = 4;
+ // remove any extra spaces
+ address = address.replace(/\s*/g, '');
+ // look for embedded ipv4
+ if (ts.regex.ipv4Validate.test(address)) {
+ groups = address.match(ts.regex.ipv4Extract);
+ t = '';
+ for (i = 1; i < groups.length; i++){
+ t += ('00' + (parseInt(groups[i], 10).toString(16)) ).slice(-2) + ( i === 2 ? ':' : '' );
+ }
+ address = address.replace( ts.regex.ipv4Extract, t );
+ }
+
+ if (address.indexOf("::") == -1) {
+ // All eight groups are present
+ fullAddress = address;
+ } else {
+ // Consecutive groups of zeroes have been collapsed with "::".
+ sides = address.split("::");
+ groupsPresent = 0;
+ for (i = 0; i < sides.length; i++) {
+ groupsPresent += sides[i].split(":").length;
+ }
+ fullAddress += sides[0] + ":";
+ for (i = 0; i < validGroupCount - groupsPresent; i++) {
+ fullAddress += "0000:";
+ }
+ fullAddress += sides[1];
+ }
+ groups = fullAddress.split(":");
+ for (i = 0; i < validGroupCount; i++) {
+ // it's fastest & easiest for tablesorter to sort decimal values (vs hex)
+ groups[i] = hex ? ('0000' + groups[i]).slice(-4) :
+ ('00000' + (parseInt(groups[i], 16) || 0)).slice(-5);
+ expandedAddress += ( i != validGroupCount-1) ? groups[i] + ':' : groups[i];
+ }
+ return hex ? expandedAddress : expandedAddress.replace(/:/g, '');
+ },
+ // uses natural sort hex compare
+ type: "numeric"
+ });
+
+})(jQuery);
diff --git a/test.html b/test.html
index 532857e9..78978f47 100644
--- a/test.html
+++ b/test.html
@@ -11,7 +11,9 @@
+
+
diff --git a/testing/testing-ipv6.js b/testing/testing-ipv6.js
new file mode 100644
index 00000000..cfeae06f
--- /dev/null
+++ b/testing/testing-ipv6.js
@@ -0,0 +1,589 @@
+var ipv6parser = $.tablesorter.getParserById('ipv6Address').format,
+ipv6test = function(result, str, expect){
+ if (result) {
+ // ok( $.tablesorter.regex.ipv6Validate.test(str), "valid: " + str );
+ // second parameter = true, so we get the hex format (false or undefined returns decimal)
+ var t = ipv6parser(str, true);
+ equal( t, expect, 'valid: ' + t + ' \u2190 "' + str + '"' );
+ } else {
+ ok( !$.tablesorter.regex.ipv6Validate.test(str), 'invalid: "' + str + '"' );
+ }
+},
+ipv6tests = function(){
+
+ test( "ipv6 parser", function() {
+ expect(483);
+
+ // IPV6 tests by Rich Brown copied from http:// download.dartware.com/thirdparty/test-ipv6-regex.pl
+ // modified to compare to canonical ipv6 output using http://www.v6decode.com/ to produce the result
+ ipv6test(!1,""); // empty string
+ ipv6test(1,"::1", "0000:0000:0000:0000:0000:0000:0000:0001"); // loopback, compressed, non-routable
+ ipv6test(1,"::", "0000:0000:0000:0000:0000:0000:0000:0000"); // unspecified, compressed, non-routable
+ ipv6test(1,"0:0:0:0:0:0:0:1", "0000:0000:0000:0000:0000:0000:0000:0001"); // loopback, full
+ ipv6test(1,"0:0:0:0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000"); // unspecified, full
+ ipv6test(1,"2001:db8:0:0:8:800:200c:417a", "2001:0db8:0000:0000:0008:0800:200c:417a"); // unicast, full
+ ipv6test(1,"ff01:0:0:0:0:0:0:101", "ff01:0000:0000:0000:0000:0000:0000:0101"); // multicast, full
+ ipv6test(1,"2001:db8::8:800:200c:417a", "2001:0db8:0000:0000:0008:0800:200c:417a"); // unicast, compressed
+ ipv6test(1,"ff01::101", "ff01:0000:0000:0000:0000:0000:0000:0101"); // multicast, compressed
+ ipv6test(!1,"2001:db8:0:0:8:800:200c:417a:221"); // unicast, full
+ ipv6test(!1,"ff01::101::2"); // multicast, compressed
+ ipv6test(1,"fe80::217:f2ff:fe07:ed62", "fe80:0000:0000:0000:0217:f2ff:fe07:ed62");
+
+ ipv6test(1,"2001:0000:1234:0000:0000:c1c0:abcd:0876", "2001:0000:1234:0000:0000:c1c0:abcd:0876");
+ ipv6test(1,"3ffe:0b00:0000:0000:0001:0000:0000:000a", "3ffe:0b00:0000:0000:0001:0000:0000:000a");
+ ipv6test(1,"ff02:0000:0000:0000:0000:0000:0000:0001", "ff02:0000:0000:0000:0000:0000:0000:0001");
+ ipv6test(1,"0000:0000:0000:0000:0000:0000:0000:0001", "0000:0000:0000:0000:0000:0000:0000:0001");
+ ipv6test(1,"0000:0000:0000:0000:0000:0000:0000:0000", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(!1,"02001:0000:1234:0000:0000:c1c0:abcd:0876"); // extra 0 not allowed!
+ ipv6test(!1,"2001:0000:1234:0000:00001:c1c0:abcd:0876"); // extra 0 not allowed!
+ // ipv6test(1," 2001:0000:1234:0000:0000:c1c0:abcd:0876"); // leading space
+ // ipv6test(1,"2001:0000:1234:0000:0000:c1c0:abcd:0876"); // trailing space
+ // ipv6test(1," 2001:0000:1234:0000:0000:c1c0:abcd:0876 "); // leading and trailing space
+ ipv6test(!1,"2001:0000:1234:0000:0000:c1c0:abcd:0876 0"); // junk after valid address
+ ipv6test(!1,"2001:0000:1234: 0000:0000:c1c0:abcd:0876"); // internal space
+
+ ipv6test(!1,"3ffe:0b00:0000:0001:0000:0000:000a"); // seven segments
+ ipv6test(!1,"ff02:0000:0000:0000:0000:0000:0000:0000:0001"); // nine segments
+ ipv6test(!1,"3ffe:b00::1::a"); // double "::"
+ ipv6test(!1,"::1111:2222:3333:4444:5555:6666::"); // double "::"
+ ipv6test(1,"2::10", "0002:0000:0000:0000:0000:0000:0000:0010");
+ ipv6test(1,"ff02::1", "ff02:0000:0000:0000:0000:0000:0000:0001");
+ ipv6test(1,"fe80::", "fe80:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"2002::", "2002:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"2001:db8::", "2001:0db8:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"2001:0db8:1234::", "2001:0db8:1234:0000:0000:0000:0000:0000");
+ ipv6test(1,"::ffff:0:0", "0000:0000:0000:0000:0000:ffff:0000:0000");
+ ipv6test(1,"1:2:3:4:5:6:7:8", "0001:0002:0003:0004:0005:0006:0007:0008");
+ ipv6test(1,"1:2:3:4:5:6::8", "0001:0002:0003:0004:0005:0006:0000:0008");
+ ipv6test(1,"1:2:3:4:5::8", "0001:0002:0003:0004:0005:0000:0000:0008");
+ ipv6test(1,"1:2:3:4::8", "0001:0002:0003:0004:0000:0000:0000:0008");
+ ipv6test(1,"1:2:3::8", "0001:0002:0003:0000:0000:0000:0000:0008");
+ ipv6test(1,"1:2::8", "0001:0002:0000:0000:0000:0000:0000:0008");
+ ipv6test(1,"1::8", "0001:0000:0000:0000:0000:0000:0000:0008");
+ ipv6test(1,"1::2:3:4:5:6:7", "0001:0000:0002:0003:0004:0005:0006:0007");
+ ipv6test(1,"1::2:3:4:5:6", "0001:0000:0000:0002:0003:0004:0005:0006");
+ ipv6test(1,"1::2:3:4:5", "0001:0000:0000:0000:0002:0003:0004:0005");
+ ipv6test(1,"1::2:3:4", "0001:0000:0000:0000:0000:0002:0003:0004");
+ ipv6test(1,"1::2:3", "0001:0000:0000:0000:0000:0000:0002:0003");
+ ipv6test(1,"1::8", "0001:0000:0000:0000:0000:0000:0000:0008");
+ ipv6test(1,"::2:3:4:5:6:7:8", "0000:0002:0003:0004:0005:0006:0007:0008");
+ ipv6test(1,"::2:3:4:5:6:7", "0000:0000:0002:0003:0004:0005:0006:0007");
+ ipv6test(1,"::2:3:4:5:6", "0000:0000:0000:0002:0003:0004:0005:0006");
+ ipv6test(1,"::2:3:4:5", "0000:0000:0000:0000:0002:0003:0004:0005");
+ ipv6test(1,"::2:3:4", "0000:0000:0000:0000:0000:0002:0003:0004");
+ ipv6test(1,"::2:3", "0000:0000:0000:0000:0000:0000:0002:0003");
+ ipv6test(1,"::8", "0000:0000:0000:0000:0000:0000:0000:0008");
+ ipv6test(1,"1:2:3:4:5:6::", "0001:0002:0003:0004:0005:0006:0000:0000");
+ ipv6test(1,"1:2:3:4:5::", "0001:0002:0003:0004:0005:0000:0000:0000");
+ ipv6test(1,"1:2:3:4::", "0001:0002:0003:0004:0000:0000:0000:0000");
+ ipv6test(1,"1:2:3::", "0001:0002:0003:0000:0000:0000:0000:0000");
+ ipv6test(1,"1:2::", "0001:0002:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"1::", "0001:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"1:2:3:4:5::7:8", "0001:0002:0003:0004:0005:0000:0007:0008");
+ ipv6test(!1,"1:2:3::4:5::7:8"); // double "::"
+ ipv6test(!1,"12345::6:7:8");
+ ipv6test(1,"1:2:3:4::7:8", "0001:0002:0003:0004:0000:0000:0007:0008");
+ ipv6test(1,"1:2:3::7:8", "0001:0002:0003:0000:0000:0000:0007:0008");
+ ipv6test(1,"1:2::7:8", "0001:0002:0000:0000:0000:0000:0007:0008");
+ ipv6test(1,"1::7:8", "0001:0000:0000:0000:0000:0000:0007:0008");
+
+ // ipv4 addresses as dotted-quads
+ ipv6test(1,"1:2:3:4:5:6:1.2.3.4", "0001:0002:0003:0004:0005:0006:0102:0304");
+ ipv6test(1,"1:2:3:4:5::1.2.3.4", "0001:0002:0003:0004:0005:0000:0102:0304");
+ ipv6test(1,"1:2:3:4::1.2.3.4", "0001:0002:0003:0004:0000:0000:0102:0304");
+ ipv6test(1,"1:2:3::1.2.3.4", "0001:0002:0003:0000:0000:0000:0102:0304");
+ ipv6test(1,"1:2::1.2.3.4", "0001:0002:0000:0000:0000:0000:0102:0304");
+ ipv6test(1,"1::1.2.3.4", "0001:0000:0000:0000:0000:0000:0102:0304");
+ ipv6test(1,"1:2:3:4::5:1.2.3.4", "0001:0002:0003:0004:0000:0005:0102:0304");
+ ipv6test(1,"1:2:3::5:1.2.3.4", "0001:0002:0003:0000:0000:0005:0102:0304");
+ ipv6test(1,"1:2::5:1.2.3.4", "0001:0002:0000:0000:0000:0005:0102:0304");
+ ipv6test(1,"1::5:1.2.3.4", "0001:0000:0000:0000:0000:0005:0102:0304");
+ ipv6test(1,"1::5:11.22.33.44", "0001:0000:0000:0000:0000:0005:0b16:212c");
+ ipv6test(!1,"1::5:400.2.3.4");
+ ipv6test(!1,"1::5:260.2.3.4");
+ ipv6test(!1,"1::5:256.2.3.4");
+ ipv6test(!1,"1::5:1.256.3.4");
+ ipv6test(!1,"1::5:1.2.256.4");
+ ipv6test(!1,"1::5:1.2.3.256");
+ ipv6test(!1,"1::5:300.2.3.4");
+ ipv6test(!1,"1::5:1.300.3.4");
+ ipv6test(!1,"1::5:1.2.300.4");
+ ipv6test(!1,"1::5:1.2.3.300");
+ ipv6test(!1,"1::5:900.2.3.4");
+ ipv6test(!1,"1::5:1.900.3.4");
+ ipv6test(!1,"1::5:1.2.900.4");
+ ipv6test(!1,"1::5:1.2.3.900");
+ ipv6test(!1,"1::5:300.300.300.300");
+ ipv6test(!1,"1::5:3000.30.30.30");
+ ipv6test(!1,"1::400.2.3.4");
+ ipv6test(!1,"1::260.2.3.4");
+ ipv6test(!1,"1::256.2.3.4");
+ ipv6test(!1,"1::1.256.3.4");
+ ipv6test(!1,"1::1.2.256.4");
+ ipv6test(!1,"1::1.2.3.256");
+ ipv6test(!1,"1::300.2.3.4");
+ ipv6test(!1,"1::1.300.3.4");
+ ipv6test(!1,"1::1.2.300.4");
+ ipv6test(!1,"1::1.2.3.300");
+ ipv6test(!1,"1::900.2.3.4");
+ ipv6test(!1,"1::1.900.3.4");
+ ipv6test(!1,"1::1.2.900.4");
+ ipv6test(!1,"1::1.2.3.900");
+ ipv6test(!1,"1::300.300.300.300");
+ ipv6test(!1,"1::3000.30.30.30");
+ ipv6test(!1,"::400.2.3.4");
+ ipv6test(!1,"::260.2.3.4");
+ ipv6test(!1,"::256.2.3.4");
+ ipv6test(!1,"::1.256.3.4");
+ ipv6test(!1,"::1.2.256.4");
+ ipv6test(!1,"::1.2.3.256");
+ ipv6test(!1,"::300.2.3.4");
+ ipv6test(!1,"::1.300.3.4");
+ ipv6test(!1,"::1.2.300.4");
+ ipv6test(!1,"::1.2.3.300");
+ ipv6test(!1,"::900.2.3.4");
+ ipv6test(!1,"::1.900.3.4");
+ ipv6test(!1,"::1.2.900.4");
+ ipv6test(!1,"::1.2.3.900");
+ ipv6test(!1,"::300.300.300.300");
+ ipv6test(!1,"::3000.30.30.30");
+ ipv6test(1,"fe80::217:f2ff:254.7.237.98", "fe80:0000:0000:0000:0217:f2ff:fe07:ed62");
+ ipv6test(1,"::ffff:192.168.1.26", "0000:0000:0000:0000:0000:ffff:c0a8:011a");
+ ipv6test(!1,"2001:1:1:1:1:1:255z255x255y255"); // garbage instead of "." in ipv4
+ ipv6test(!1,"::ffff:192x168.1.26"); // ditto
+ ipv6test(1,"::ffff:192.168.1.1", "0000:0000:0000:0000:0000:ffff:c0a8:0101");
+ ipv6test(1,"0:0:0:0:0:0:13.1.68.3", "0000:0000:0000:0000:0000:0000:0d01:4403"); // ipv4-compatible ipv6 address, full, deprecated
+ ipv6test(1,"0:0:0:0:0:ffff:129.144.52.38", "0000:0000:0000:0000:0000:ffff:8190:3426"); // ipv4-mapped ipv6 address, full
+ ipv6test(1,"::13.1.68.3", "0000:0000:0000:0000:0000:0000:0d01:4403"); // ipv4-compatible ipv6 address, compressed, deprecated
+ ipv6test(1,"::ffff:129.144.52.38", "0000:0000:0000:0000:0000:ffff:8190:3426"); // ipv4-mapped ipv6 address, compressed
+ ipv6test(1,"fe80:0:0:0:204:61ff:254.157.241.86", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
+ ipv6test(1,"fe80::204:61ff:254.157.241.86", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
+ ipv6test(1,"::ffff:12.34.56.78", "0000:0000:0000:0000:0000:ffff:0c22:384e");
+ ipv6test(!1,"::ffff:2.3.4");
+ ipv6test(!1,"::ffff:257.1.2.3");
+ ipv6test(!1,"1.2.3.4");
+
+ ipv6test(!1,"1.2.3.4:1111:2222:3333:4444::5555"); // aeron
+ ipv6test(!1,"1.2.3.4:1111:2222:3333::5555");
+ ipv6test(!1,"1.2.3.4:1111:2222::5555");
+ ipv6test(!1,"1.2.3.4:1111::5555");
+ ipv6test(!1,"1.2.3.4::5555");
+ ipv6test(!1,"1.2.3.4::");
+
+ // testing ipv4 addresses represented as dotted-quads
+ // leading zero's in ipv4 addresses not allowed: some systems treat the leading "0" in ".086" as the start of an octal number
+ // update: the bnf in rfc-3986 explicitly defines the dec-octet (for ipv4 addresses) not to have a leading zero
+ ipv6test(!1,"fe80:0000:0000:0000:0204:61ff:254.157.241.086");
+ ipv6test(1,"::ffff:192.0.2.128", "0000:0000:0000:0000:0000:ffff:c000:0280"); // but this is ok, since there's a single digit
+ ipv6test(!1,"xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:00.00.00.00");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:000.000.000.000");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:256.256.256.256");
+
+ // not testing address with subnet mask
+ // ipv6test(1,"2001:0db8:0000:cd30:0000:0000:0000:0000/60"); // full, with prefix
+ // ipv6test(1,"2001:0db8::cd30:0:0:0:0/60"); // compressed, with prefix
+ // ipv6test(1,"2001:0db8:0:cd30::/60"); // compressed, with prefix // 2
+ // ipv6test(1,"::/128"); // compressed, unspecified address type, non-routable
+ // ipv6test(1,"::1/128"); // compressed, loopback address type, non-routable
+ // ipv6test(1,"ff00::/8"); // compressed, multicast address type
+ // ipv6test(1,"fe80::/10"); // compressed, link-local unicast, non-routable
+ // ipv6test(1,"fec0::/10"); // compressed, site-local unicast, deprecated
+ // ipv6test(!1,"124.15.6.89/60"); // standard ipv4, prefix not allowed
+
+ ipv6test(1,"fe80:0000:0000:0000:0204:61ff:fe9d:f156", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
+ ipv6test(1,"fe80:0:0:0:204:61ff:fe9d:f156", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
+ ipv6test(1,"fe80::204:61ff:fe9d:f156", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
+ ipv6test(1,"fe80::", "fe80:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"fe80::1", "fe80:0000:0000:0000:0000:0000:0000:0001");
+ ipv6test(!1,":");
+ ipv6test(1,"::ffff:c000:280", "0000:0000:0000:0000:0000:ffff:c000:0280");
+
+ // aeron supplied these test cases
+ ipv6test(!1,"1111:2222:3333:4444::5555:");
+ ipv6test(!1,"1111:2222:3333::5555:");
+ ipv6test(!1,"1111:2222::5555:");
+ ipv6test(!1,"1111::5555:");
+ ipv6test(!1,"::5555:");
+ ipv6test(!1,":::");
+ ipv6test(!1,"1111:");
+ ipv6test(!1,":");
+
+ ipv6test(!1,":1111:2222:3333:4444::5555");
+ ipv6test(!1,":1111:2222:3333::5555");
+ ipv6test(!1,":1111:2222::5555");
+ ipv6test(!1,":1111::5555");
+ ipv6test(!1,":::5555");
+ ipv6test(!1,":::");
+
+
+ // additional test cases
+ // from http:// rt.cpan.org/public/bug/display.html?id=50693
+
+ ipv6test(1,"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
+ ipv6test(1,"2001:db8:85a3:0:0:8a2e:370:7334", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
+ ipv6test(1,"2001:db8:85a3::8a2e:370:7334", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
+ ipv6test(1,"2001:0db8:0000:0000:0000:0000:1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
+ ipv6test(1,"2001:0db8:0000:0000:0000::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
+ ipv6test(1,"2001:0db8:0:0:0:0:1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
+ ipv6test(1,"2001:0db8:0:0::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
+ ipv6test(1,"2001:0db8::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
+ ipv6test(1,"2001:db8::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
+ ipv6test(1,"0000:0000:0000:0000:0000:0000:0000:0001", "0000:0000:0000:0000:0000:0000:0000:0001");
+ ipv6test(1,"::ffff:0c22:384e", "0000:0000:0000:0000:0000:ffff:0c22:384e");
+ ipv6test(1,"2001:0db8:1234:0000:0000:0000:0000:0000", "2001:0db8:1234:0000:0000:0000:0000:0000");
+ ipv6test(1,"2001:0db8:1234:ffff:ffff:ffff:ffff:ffff", "2001:0db8:1234:ffff:ffff:ffff:ffff:ffff");
+ ipv6test(1,"2001:db8:a::123", "2001:0db8:000a:0000:0000:0000:0000:0123");
+ ipv6test(1,"fe80::", "fe80:0000:0000:0000:0000:0000:0000:0000");
+
+ ipv6test(!1,"123");
+ ipv6test(!1,"ldkfj");
+ ipv6test(!1,"2001::ffd3::57ab");
+ ipv6test(!1,"2001:db8:85a3::8a2e:37023:7334");
+ ipv6test(!1,"2001:db8:85a3::8a2e:370k:7334");
+ ipv6test(!1,"1:2:3:4:5:6:7:8:9");
+ ipv6test(!1,"1::2::3");
+ ipv6test(!1,"1:::3:4:5");
+ ipv6test(!1,"1:2:3::4:5:6:7:8:9");
+
+ // new from aeron
+ ipv6test(1,"1111:2222:3333:4444:5555:6666:7777:8888", "1111:2222:3333:4444:5555:6666:7777:8888");
+ ipv6test(1,"1111:2222:3333:4444:5555:6666:7777::", "1111:2222:3333:4444:5555:6666:7777:0000");
+ ipv6test(1,"1111:2222:3333:4444:5555:6666::", "1111:2222:3333:4444:5555:6666:0000:0000");
+ ipv6test(1,"1111:2222:3333:4444:5555::", "1111:2222:3333:4444:5555:0000:0000:0000");
+ ipv6test(1,"1111:2222:3333:4444::", "1111:2222:3333:4444:0000:0000:0000:0000");
+ ipv6test(1,"1111:2222:3333::", "1111:2222:3333:0000:0000:0000:0000:0000");
+ ipv6test(1,"1111:2222::", "1111:2222:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"1111::", "1111:0000:0000:0000:0000:0000:0000:0000");
+ // ipv6test(1,"::", ""); // duplicate
+ ipv6test(1,"1111:2222:3333:4444:5555:6666::8888", "1111:2222:3333:4444:5555:6666:0000:8888");
+ ipv6test(1,"1111:2222:3333:4444:5555::8888", "1111:2222:3333:4444:5555:0000:0000:8888");
+ ipv6test(1,"1111:2222:3333:4444::8888", "1111:2222:3333:4444:0000:0000:0000:8888");
+ ipv6test(1,"1111:2222:3333::8888", "1111:2222:3333:0000:0000:0000:0000:8888");
+ ipv6test(1,"1111:2222::8888", "1111:2222:0000:0000:0000:0000:0000:8888");
+ ipv6test(1,"1111::8888", "1111:0000:0000:0000:0000:0000:0000:8888");
+ ipv6test(1,"::8888", "0000:0000:0000:0000:0000:0000:0000:8888");
+ ipv6test(1,"1111:2222:3333:4444:5555::7777:8888", "1111:2222:3333:4444:5555:0000:7777:8888");
+ ipv6test(1,"1111:2222:3333:4444::7777:8888", "1111:2222:3333:4444:0000:0000:7777:8888");
+ ipv6test(1,"1111:2222:3333::7777:8888", "1111:2222:3333:0000:0000:0000:7777:8888");
+ ipv6test(1,"1111:2222::7777:8888", "1111:2222:0000:0000:0000:0000:7777:8888");
+ ipv6test(1,"1111::7777:8888", "1111:0000:0000:0000:0000:0000:7777:8888");
+ ipv6test(1,"::7777:8888", "0000:0000:0000:0000:0000:0000:7777:8888");
+ ipv6test(1,"1111:2222:3333:4444::6666:7777:8888", "1111:2222:3333:4444:0000:6666:7777:8888");
+ ipv6test(1,"1111:2222:3333::6666:7777:8888", "1111:2222:3333:0000:0000:6666:7777:8888");
+ ipv6test(1,"1111:2222::6666:7777:8888", "1111:2222:0000:0000:0000:6666:7777:8888");
+ ipv6test(1,"1111::6666:7777:8888", "1111:0000:0000:0000:0000:6666:7777:8888");
+ ipv6test(1,"::6666:7777:8888", "0000:0000:0000:0000:0000:6666:7777:8888");
+ ipv6test(1,"1111:2222:3333::5555:6666:7777:8888", "1111:2222:3333:0000:5555:6666:7777:8888");
+ ipv6test(1,"1111:2222::5555:6666:7777:8888", "1111:2222:0000:0000:5555:6666:7777:8888");
+ ipv6test(1,"1111::5555:6666:7777:8888", "1111:0000:0000:0000:5555:6666:7777:8888");
+ ipv6test(1,"::5555:6666:7777:8888", "0000:0000:0000:0000:5555:6666:7777:8888");
+ ipv6test(1,"1111:2222::4444:5555:6666:7777:8888", "1111:2222:0000:4444:5555:6666:7777:8888");
+ ipv6test(1,"1111::4444:5555:6666:7777:8888", "1111:0000:0000:4444:5555:6666:7777:8888");
+ ipv6test(1,"::4444:5555:6666:7777:8888", "0000:0000:0000:4444:5555:6666:7777:8888");
+ ipv6test(1,"1111::3333:4444:5555:6666:7777:8888", "1111:0000:3333:4444:5555:6666:7777:8888");
+ ipv6test(1,"::3333:4444:5555:6666:7777:8888", "0000:0000:3333:4444:5555:6666:7777:8888");
+ ipv6test(1,"::2222:3333:4444:5555:6666:7777:8888", "0000:2222:3333:4444:5555:6666:7777:8888");
+ ipv6test(1,"1111:2222:3333:4444:5555:6666:123.123.123.123", "1111:2222:3333:4444:5555:6666:7b7b:7b7b");
+ ipv6test(1,"1111:2222:3333:4444:5555::123.123.123.123", "1111:2222:3333:4444:5555:0000:7b7b:7b7b");
+ ipv6test(1,"1111:2222:3333:4444::123.123.123.123", "1111:2222:3333:4444:0000:0000:7b7b:7b7b");
+ ipv6test(1,"1111:2222:3333::123.123.123.123", "1111:2222:3333:0000:0000:0000:7b7b:7b7b");
+ ipv6test(1,"1111:2222::123.123.123.123", "1111:2222:0000:0000:0000:0000:7b7b:7b7b");
+ ipv6test(1,"1111::123.123.123.123", "1111:0000:0000:0000:0000:0000:7b7b:7b7b");
+ ipv6test(1,"::123.123.123.123", "0000:0000:0000:0000:0000:0000:7b7b:7b7b");
+ ipv6test(1,"1111:2222:3333:4444::6666:123.123.123.123", "1111:2222:3333:4444:0000:6666:7b7b:7b7b");
+ ipv6test(1,"1111:2222:3333::6666:123.123.123.123", "1111:2222:3333:0000:0000:6666:7b7b:7b7b");
+ ipv6test(1,"1111:2222::6666:123.123.123.123", "1111:2222:0000:0000:0000:6666:7b7b:7b7b");
+ ipv6test(1,"1111::6666:123.123.123.123", "1111:0000:0000:0000:0000:6666:7b7b:7b7b");
+ ipv6test(1,"::6666:123.123.123.123", "0000:0000:0000:0000:0000:6666:7b7b:7b7b");
+ ipv6test(1,"1111:2222:3333::5555:6666:123.123.123.123", "1111:2222:3333:0000:5555:6666:7b7b:7b7b");
+ ipv6test(1,"1111:2222::5555:6666:123.123.123.123", "1111:2222:0000:0000:5555:6666:7b7b:7b7b");
+ ipv6test(1,"1111::5555:6666:123.123.123.123", "1111:0000:0000:0000:5555:6666:7b7b:7b7b");
+ ipv6test(1,"::5555:6666:123.123.123.123", "0000:0000:0000:0000:5555:6666:7b7b:7b7b");
+ ipv6test(1,"1111:2222::4444:5555:6666:123.123.123.123", "1111:2222:0000:4444:5555:6666:7b7b:7b7b");
+ ipv6test(1,"1111::4444:5555:6666:123.123.123.123", "1111:0000:0000:4444:5555:6666:7b7b:7b7b");
+ ipv6test(1,"::4444:5555:6666:123.123.123.123", "0000:0000:0000:4444:5555:6666:7b7b:7b7b");
+ ipv6test(1,"1111::3333:4444:5555:6666:123.123.123.123", "1111:0000:3333:4444:5555:6666:7b7b:7b7b");
+ ipv6test(1,"::2222:3333:4444:5555:6666:123.123.123.123", "0000:2222:3333:4444:5555:6666:7b7b:7b7b");
+
+ // playing with combinations of "0" and "::"
+ // nb: these are all sytactically correct, but are bad form
+ // because "0" adjacent to "::" should be combined into "::"
+ ipv6test(1,"::0:0:0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"::0:0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"::0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"::0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"::0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"::0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"::0", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"0:0:0:0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"0:0:0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"0:0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
+ ipv6test(1,"0::", "0000:0000:0000:0000:0000:0000:0000:0000");
+
+ // new invalid from aeron
+ // invalid data
+ ipv6test(!1,"xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx");
+
+ // too many components
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888:9999");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888::");
+ ipv6test(!1,"::2222:3333:4444:5555:6666:7777:8888:9999");
+
+ // too few components
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666");
+ ipv6test(!1,"1111:2222:3333:4444:5555");
+ ipv6test(!1,"1111:2222:3333:4444");
+ ipv6test(!1,"1111:2222:3333");
+ ipv6test(!1,"1111:2222");
+ ipv6test(!1,"1111");
+
+ // missing :
+ ipv6test(!1,"11112222:3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,"1111:22223333:4444:5555:6666:7777:8888");
+ ipv6test(!1,"1111:2222:33334444:5555:6666:7777:8888");
+ ipv6test(!1,"1111:2222:3333:44445555:6666:7777:8888");
+ ipv6test(!1,"1111:2222:3333:4444:55556666:7777:8888");
+ ipv6test(!1,"1111:2222:3333:4444:5555:66667777:8888");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:77778888");
+
+ // missing : intended for ::
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888:");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:");
+ ipv6test(!1,"1111:2222:3333:4444:5555:");
+ ipv6test(!1,"1111:2222:3333:4444:");
+ ipv6test(!1,"1111:2222:3333:");
+ ipv6test(!1,"1111:2222:");
+ ipv6test(!1,"1111:");
+ ipv6test(!1,":");
+ ipv6test(!1,":8888");
+ ipv6test(!1,":7777:8888");
+ ipv6test(!1,":6666:7777:8888");
+ ipv6test(!1,":5555:6666:7777:8888");
+ ipv6test(!1,":4444:5555:6666:7777:8888");
+ ipv6test(!1,":3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,":2222:3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,":1111:2222:3333:4444:5555:6666:7777:8888");
+
+ // :::
+ ipv6test(!1,":::2222:3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,"1111:::3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,"1111:2222:::4444:5555:6666:7777:8888");
+ ipv6test(!1,"1111:2222:3333:::5555:6666:7777:8888");
+ ipv6test(!1,"1111:2222:3333:4444:::6666:7777:8888");
+ ipv6test(!1,"1111:2222:3333:4444:5555:::7777:8888");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:::8888");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:::");
+
+ // double ::");
+ ipv6test(!1,"::2222::4444:5555:6666:7777:8888");
+ ipv6test(!1,"::2222:3333::5555:6666:7777:8888");
+ ipv6test(!1,"::2222:3333:4444::6666:7777:8888");
+ ipv6test(!1,"::2222:3333:4444:5555::7777:8888");
+ ipv6test(!1,"::2222:3333:4444:5555:7777::8888");
+ ipv6test(!1,"::2222:3333:4444:5555:7777:8888::");
+
+ ipv6test(!1,"1111::3333::5555:6666:7777:8888");
+ ipv6test(!1,"1111::3333:4444::6666:7777:8888");
+ ipv6test(!1,"1111::3333:4444:5555::7777:8888");
+ ipv6test(!1,"1111::3333:4444:5555:6666::8888");
+ ipv6test(!1,"1111::3333:4444:5555:6666:7777::");
+
+ ipv6test(!1,"1111:2222::4444::6666:7777:8888");
+ ipv6test(!1,"1111:2222::4444:5555::7777:8888");
+ ipv6test(!1,"1111:2222::4444:5555:6666::8888");
+ ipv6test(!1,"1111:2222::4444:5555:6666:7777::");
+
+ ipv6test(!1,"1111:2222:3333::5555::7777:8888");
+ ipv6test(!1,"1111:2222:3333::5555:6666::8888");
+ ipv6test(!1,"1111:2222:3333::5555:6666:7777::");
+
+ ipv6test(!1,"1111:2222:3333:4444::6666::8888");
+ ipv6test(!1,"1111:2222:3333:4444::6666:7777::");
+
+ ipv6test(!1,"1111:2222:3333:4444:5555::7777::");
+
+
+ // too many components"
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666::1.2.3.4");
+ ipv6test(!1,"::2222:3333:4444:5555:6666:7777:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:1.2.3.4.5");
+
+ // too few components
+ ipv6test(!1,"1111:2222:3333:4444:5555:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:1.2.3.4");
+ ipv6test(!1,"1111:2222:1.2.3.4");
+ ipv6test(!1,"1111:1.2.3.4");
+ ipv6test(!1,"1.2.3.4");
+
+ // missing :
+ ipv6test(!1,"11112222:3333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,"1111:22223333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,"1111:2222:33334444:5555:6666:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:44445555:6666:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:55556666:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:5555:66661.2.3.4");
+
+ // missing .
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:255255.255.255");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:255.255255.255");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:255.255.255255");
+
+ // missing : intended for ::
+ ipv6test(!1,":1.2.3.4");
+ ipv6test(!1,":6666:1.2.3.4");
+ ipv6test(!1,":5555:6666:1.2.3.4");
+ ipv6test(!1,":4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":3333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":2222:3333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":1111:2222:3333:4444:5555:6666:1.2.3.4");
+
+ // :::
+ ipv6test(!1,":::2222:3333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,"1111:::3333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,"1111:2222:::4444:5555:6666:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:::5555:6666:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:::6666:1.2.3.4");
+ ipv6test(!1,"1111:2222:3333:4444:5555:::1.2.3.4");
+
+ // double ::
+ ipv6test(!1,"::2222::4444:5555:6666:1.2.3.4");
+ ipv6test(!1,"::2222:3333::5555:6666:1.2.3.4");
+ ipv6test(!1,"::2222:3333:4444::6666:1.2.3.4");
+ ipv6test(!1,"::2222:3333:4444:5555::1.2.3.4");
+
+ ipv6test(!1,"1111::3333::5555:6666:1.2.3.4");
+ ipv6test(!1,"1111::3333:4444::6666:1.2.3.4");
+ ipv6test(!1,"1111::3333:4444:5555::1.2.3.4");
+
+ ipv6test(!1,"1111:2222::4444::6666:1.2.3.4");
+ ipv6test(!1,"1111:2222::4444:5555::1.2.3.4");
+
+ ipv6test(!1,"1111:2222:3333::5555::1.2.3.4");
+
+ // missing parts
+ ipv6test(!1,"::.");
+ ipv6test(!1,"::..");
+ ipv6test(!1,"::...");
+ ipv6test(!1,"::1...");
+ ipv6test(!1,"::1.2..");
+ ipv6test(!1,"::1.2.3.");
+ ipv6test(!1,"::.2..");
+ ipv6test(!1,"::.2.3.");
+ ipv6test(!1,"::.2.3.4");
+ ipv6test(!1,"::..3.");
+ ipv6test(!1,"::..3.4");
+ ipv6test(!1,"::...4");
+
+ // extra : in front
+ ipv6test(!1,":1111:2222:3333:4444:5555:6666:7777::");
+ ipv6test(!1,":1111:2222:3333:4444:5555:6666::");
+ ipv6test(!1,":1111:2222:3333:4444:5555::");
+ ipv6test(!1,":1111:2222:3333:4444::");
+ ipv6test(!1,":1111:2222:3333::");
+ ipv6test(!1,":1111:2222::");
+ ipv6test(!1,":1111::");
+ ipv6test(!1,":::");
+ ipv6test(!1,":1111:2222:3333:4444:5555:6666::8888");
+ ipv6test(!1,":1111:2222:3333:4444:5555::8888");
+ ipv6test(!1,":1111:2222:3333:4444::8888");
+ ipv6test(!1,":1111:2222:3333::8888");
+ ipv6test(!1,":1111:2222::8888");
+ ipv6test(!1,":1111::8888");
+ ipv6test(!1,":::8888");
+ ipv6test(!1,":1111:2222:3333:4444:5555::7777:8888");
+ ipv6test(!1,":1111:2222:3333:4444::7777:8888");
+ ipv6test(!1,":1111:2222:3333::7777:8888");
+ ipv6test(!1,":1111:2222::7777:8888");
+ ipv6test(!1,":1111::7777:8888");
+ ipv6test(!1,":::7777:8888");
+ ipv6test(!1,":1111:2222:3333:4444::6666:7777:8888");
+ ipv6test(!1,":1111:2222:3333::6666:7777:8888");
+ ipv6test(!1,":1111:2222::6666:7777:8888");
+ ipv6test(!1,":1111::6666:7777:8888");
+ ipv6test(!1,":::6666:7777:8888");
+ ipv6test(!1,":1111:2222:3333::5555:6666:7777:8888");
+ ipv6test(!1,":1111:2222::5555:6666:7777:8888");
+ ipv6test(!1,":1111::5555:6666:7777:8888");
+ ipv6test(!1,":::5555:6666:7777:8888");
+ ipv6test(!1,":1111:2222::4444:5555:6666:7777:8888");
+ ipv6test(!1,":1111::4444:5555:6666:7777:8888");
+ ipv6test(!1,":::4444:5555:6666:7777:8888");
+ ipv6test(!1,":1111::3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,":::3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,":::2222:3333:4444:5555:6666:7777:8888");
+ ipv6test(!1,":1111:2222:3333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":1111:2222:3333:4444:5555::1.2.3.4");
+ ipv6test(!1,":1111:2222:3333:4444::1.2.3.4");
+ ipv6test(!1,":1111:2222:3333::1.2.3.4");
+ ipv6test(!1,":1111:2222::1.2.3.4");
+ ipv6test(!1,":1111::1.2.3.4");
+ ipv6test(!1,":::1.2.3.4");
+ ipv6test(!1,":1111:2222:3333:4444::6666:1.2.3.4");
+ ipv6test(!1,":1111:2222:3333::6666:1.2.3.4");
+ ipv6test(!1,":1111:2222::6666:1.2.3.4");
+ ipv6test(!1,":1111::6666:1.2.3.4");
+ ipv6test(!1,":::6666:1.2.3.4");
+ ipv6test(!1,":1111:2222:3333::5555:6666:1.2.3.4");
+ ipv6test(!1,":1111:2222::5555:6666:1.2.3.4");
+ ipv6test(!1,":1111::5555:6666:1.2.3.4");
+ ipv6test(!1,":::5555:6666:1.2.3.4");
+ ipv6test(!1,":1111:2222::4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":1111::4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":::4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":1111::3333:4444:5555:6666:1.2.3.4");
+ ipv6test(!1,":::2222:3333:4444:5555:6666:1.2.3.4");
+
+ // extra : at end
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:::");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666:::");
+ ipv6test(!1,"1111:2222:3333:4444:5555:::");
+ ipv6test(!1,"1111:2222:3333:4444:::");
+ ipv6test(!1,"1111:2222:3333:::");
+ ipv6test(!1,"1111:2222:::");
+ ipv6test(!1,"1111:::");
+ ipv6test(!1,":::");
+ ipv6test(!1,"1111:2222:3333:4444:5555:6666::8888:");
+ ipv6test(!1,"1111:2222:3333:4444:5555::8888:");
+ ipv6test(!1,"1111:2222:3333:4444::8888:");
+ ipv6test(!1,"1111:2222:3333::8888:");
+ ipv6test(!1,"1111:2222::8888:");
+ ipv6test(!1,"1111::8888:");
+ ipv6test(!1,"::8888:");
+ ipv6test(!1,"1111:2222:3333:4444:5555::7777:8888:");
+ ipv6test(!1,"1111:2222:3333:4444::7777:8888:");
+ ipv6test(!1,"1111:2222:3333::7777:8888:");
+ ipv6test(!1,"1111:2222::7777:8888:");
+ ipv6test(!1,"1111::7777:8888:");
+ ipv6test(!1,"::7777:8888:");
+ ipv6test(!1,"1111:2222:3333:4444::6666:7777:8888:");
+ ipv6test(!1,"1111:2222:3333::6666:7777:8888:");
+ ipv6test(!1,"1111:2222::6666:7777:8888:");
+ ipv6test(!1,"1111::6666:7777:8888:");
+ ipv6test(!1,"::6666:7777:8888:");
+ ipv6test(!1,"1111:2222:3333::5555:6666:7777:8888:");
+ ipv6test(!1,"1111:2222::5555:6666:7777:8888:");
+ ipv6test(!1,"1111::5555:6666:7777:8888:");
+ ipv6test(!1,"::5555:6666:7777:8888:");
+ ipv6test(!1,"1111:2222::4444:5555:6666:7777:8888:");
+ ipv6test(!1,"1111::4444:5555:6666:7777:8888:");
+ ipv6test(!1,"::4444:5555:6666:7777:8888:");
+ ipv6test(!1,"1111::3333:4444:5555:6666:7777:8888:");
+ ipv6test(!1,"::3333:4444:5555:6666:7777:8888:");
+ ipv6test(!1,"::2222:3333:4444:5555:6666:7777:8888:");
+
+ // additional cases: http:// crisp.tweakblogs.net/blog/2031/ipv6-validation-%28and-caveats%29.html
+ ipv6test(1,"0:a:b:c:d:e:f::", "0000:000a:000b:000c:000d:000e:000f:0000");
+ ipv6test(1,"::0:a:b:c:d:e:f", "0000:0000:000a:000b:000c:000d:000e:000f"); // syntactically correct, but bad form (::0:... could be combined)
+ ipv6test(1,"a:b:c:d:e:f:0::", "000a:000b:000c:000d:000e:000f:0000:0000");
+ ipv6test(!1,"':10.0.0.1");
+ });
+};
\ No newline at end of file