]> gitweb.factorcode.org Git - factor.git/commitdiff
inet6 address components cannot be stored as bytes as they are 16 bits long
authorSamuel Tardieu <sam@rfc1149.net>
Fri, 16 Jan 2009 09:17:36 +0000 (10:17 +0100)
committerSamuel Tardieu <sam@rfc1149.net>
Fri, 16 Jan 2009 10:06:32 +0000 (11:06 +0100)
basis/io/sockets/sockets-tests.factor
basis/io/sockets/sockets.factor

index 4b95a31512ff524822db6c404ae0fc549e48d707..dc0c698699b8d68b940cf4296018d20c38fdd08f 100644 (file)
@@ -33,6 +33,9 @@ concurrency.promises threads io.streams.string ;
 [ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } ]
 [ "::1" T{ inet6 } inet-pton ] unit-test
 
+[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 } ]
+[ "::100" T{ inet6 } inet-pton ] unit-test
+
 [ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } ]
 [ "1::2" T{ inet6 } inet-pton ] unit-test
 
@@ -45,6 +48,9 @@ concurrency.promises threads io.streams.string ;
 [ "1:2:0:0:0:0:3:4" ]
 [ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } T{ inet6 } inet-ntop ] unit-test
 
+[ "2001:6f8:37a:5:0:0:0:1" ]
+[ "2001:6f8:37a:5::1" T{ inet6 } [ inet-pton ] [ inet-ntop ] bi ] unit-test
+
 [ t ] [ "localhost" 80 <inet> resolve-host length 1 >= ] unit-test
 
 ! Smoke-test UDP
index 0ef485b74cca7840e2ec79ecab79f49f62718c88..8dce5275531aa0f218122220a4d70c2dfb1e55e9 100644 (file)
@@ -109,7 +109,7 @@ M: invalid-inet6 summary drop "Invalid IPv6 address" ;
     [ f ] [
         ":" split [
             hex> [ "Component not a number" throw ] unless*
-        ] B{ } map-as
+        ] { } map-as
     ] if-empty ;
 
 : pad-inet6 ( string1 string2 -- seq )