2 USING: ip-parser kernel sequences tools.test ;
4 { "0.0.0.1" } [ "1" normalize-ipv4 ] unit-test
5 { "1.0.0.2" } [ "1.2" normalize-ipv4 ] unit-test
6 { "1.2.0.3" } [ "1.2.3" normalize-ipv4 ] unit-test
7 { "1.2.3.4" } [ "1.2.3.4" normalize-ipv4 ] unit-test
8 [ "1.2.3.4.5" normalize-ipv4 ] must-fail
9 { "0.0.0.255" } [ "255" normalize-ipv4 ] unit-test
10 { "0.0.1.0" } [ "256" normalize-ipv4 ] unit-test
14 "1249763844" ! flat decimal
15 "0112.0175.0342.0004" ! dotted octal
16 "011237361004" ! flat octal
17 "0x4A.0x7D.0xE2.0x04" ! dotted hex
18 "0x4A7DE204" ! flat hex
20 } [ normalize-ipv4 "74.125.226.4" = ] all?
23 { "74.125.226.4" } [ 1249763844 ipv4-ntoa ] unit-test
24 { 1249763844 } [ "74.125.226.4" ipv4-aton ] unit-test
26 { { 0 0 0 0 0 0 0 1 } } [ "::1" parse-ipv6 ] unit-test
30 "2001:0db8:0000:0000:0000:ff00:0042:8329"
31 "2001:db8:0:0:0:ff00:42:8329"
32 "2001:db8::ff00:42:8329"
33 } [ parse-ipv6 { 8193 3512 0 0 0 65280 66 33577 } = ] all?