diff options
Diffstat (limited to 'tests/014/inaddr-str.tl')
-rw-r--r-- | tests/014/inaddr-str.tl | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/014/inaddr-str.tl b/tests/014/inaddr-str.tl new file mode 100644 index 00000000..67283188 --- /dev/null +++ b/tests/014/inaddr-str.tl @@ -0,0 +1,78 @@ +(load "../common.tl") + +(test (inaddr-str "junk") :error) +(test (inaddr-str "0.0.0.0.0") :error) +(test (inaddr-str "0.0.0") :error) +(test (inaddr-str "0") :error) +(test (inaddr-str "") :error) +(test (inaddr-str "0.0.0.nnn") :error) +(test (inaddr-str "0.0.0.256") :error) +(test (inaddr-str "0.0.256.0") :error) +(test (inaddr-str "0.256.0.0") :error) +(test (inaddr-str "256.0.0.0") :error) +(test (inaddr-str "0.0.0.0:65537") :error) +(test (inaddr-str "0.0.0.0/33") :error) +(test (inaddr-str "0.0.0.0/32:65537") :error) +(test (inaddr-str "0.0.0.0/33:0") :error) +(test (inaddr-str "0.0.0.0:0/0") :error) +(test (inaddr-str "0.0.0.") :error) +(test (inaddr-str "0.0..0") :error) +(test (inaddr-str "0..0.0") :error) +(test (inaddr-str ".0.0.0") :error) +(test (inaddr-str "0.0.0.0:") :error) + +(test (inaddr-str "0.0.0.0") + #S(sockaddr-in addr 0 port 0 prefix 32)) +(test (inaddr-str "1.2.3.4") + #S(sockaddr-in addr 16909060 port 0 prefix 32)) +(test (inaddr-str "255.255.255.255") + #S(sockaddr-in addr 4294967295 port 0 prefix 32)) + +(test (inaddr-str "0.0.0.0:0") + #S(sockaddr-in addr 0 port 0 prefix 32)) +(test (inaddr-str "1.2.3.4:5") + #S(sockaddr-in addr 16909060 port 5 prefix 32)) +(test (inaddr-str "255.255.255.255:65535") + #S(sockaddr-in addr 4294967295 port 65535 prefix 32)) + +(test (inaddr-str "0.0.0.0/0") + #S(sockaddr-in addr 0 port 0 prefix 0)) +(test (inaddr-str "1.2.3.4/8") + #S(sockaddr-in addr 16777216 port 0 prefix 8)) +(test (inaddr-str "255.255.255.255/24") + #S(sockaddr-in addr 4294967040 port 0 prefix 24)) + +(test (inaddr-str "0.0.0/0") + #S(sockaddr-in addr 0 port 0 prefix 0)) +(test (inaddr-str "0.0/0") + #S(sockaddr-in addr 0 port 0 prefix 0)) +(test (inaddr-str "0/0") + #S(sockaddr-in addr 0 port 0 prefix 0)) + +(test (inaddr-str "1.2.3/8") + #S(sockaddr-in addr 16777216 port 0 prefix 8)) +(test (inaddr-str "1.2/8") + #S(sockaddr-in addr 16777216 port 0 prefix 8)) +(test (inaddr-str "1/8") + #S(sockaddr-in addr 16777216 port 0 prefix 8)) + +(test (inaddr-str "0.0.0.0/0:1234") + #S(sockaddr-in addr 0 port 1234 prefix 0)) +(test (inaddr-str "1.2.3.4/8:1234") + #S(sockaddr-in addr 16777216 port 1234 prefix 8)) +(test (inaddr-str "255.255.255.255/24:1234") + #S(sockaddr-in addr 4294967040 port 1234 prefix 24)) + +(test (inaddr-str "0.0.0/0:1234") + #S(sockaddr-in addr 0 port 1234 prefix 0)) +(test (inaddr-str "0.0/0:1234") + #S(sockaddr-in addr 0 port 1234 prefix 0)) +(test (inaddr-str "0/0:1234") + #S(sockaddr-in addr 0 port 1234 prefix 0)) + +(test (inaddr-str "1.2.3/8:1234") + #S(sockaddr-in addr 16777216 port 1234 prefix 8)) +(test (inaddr-str "1.2/8:1234") + #S(sockaddr-in addr 16777216 port 1234 prefix 8)) +(test (inaddr-str "1/8:1234") + #S(sockaddr-in addr 16777216 port 1234 prefix 8)) |