summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-02-12 19:14:30 +0100
committerAndreas Schneider <asn@cryptomilk.org>2011-02-12 19:22:02 +0100
commit840e1abcdcdb641fa22d06982dbf84a043bf6e18 (patch)
treeb7f6ddb141b4770fa9cb13ff6c586276766b7c9c
parente3594ba0ecdfa11860e6cfb2577a1f9b3972c879 (diff)
downloadlibssh-840e1abcdcdb641fa22d06982dbf84a043bf6e18.tar.gz
libssh-840e1abcdcdb641fa22d06982dbf84a043bf6e18.tar.xz
libssh-840e1abcdcdb641fa22d06982dbf84a043bf6e18.zip
tests: Added ipv6 tests.
(cherry picked from commit 5d4bd5a21d9b903341c175696b0c747076672572)
-rw-r--r--tests/unittests/torture_isipaddr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unittests/torture_isipaddr.c b/tests/unittests/torture_isipaddr.c
index 83cf161d..f1cd6b7a 100644
--- a/tests/unittests/torture_isipaddr.c
+++ b/tests/unittests/torture_isipaddr.c
@@ -9,6 +9,7 @@
*/
static void torture_ssh_is_ipaddr(void **state) {
(void)state;
+
assert_int_equal(ssh_is_ipaddr("127.0.0.1"),1);
assert_int_equal(ssh_is_ipaddr("0.0.0.0"),1);
assert_int_equal(ssh_is_ipaddr("1.1.1.1"),1);
@@ -17,6 +18,13 @@ static void torture_ssh_is_ipaddr(void **state) {
assert_int_equal(ssh_is_ipaddr("1.10.100.1"),1);
assert_int_equal(ssh_is_ipaddr("0.1.10.100"),1);
+ assert_int_equal(ssh_is_ipaddr("2001:0db8:85a3:0000:0000:8a2e:0370:7334"),1);
+ assert_int_equal(ssh_is_ipaddr("fe80:0000:0000:0000:0202:b3ff:fe1e:8329"),1);
+ assert_int_equal(ssh_is_ipaddr("fe80:0:0:0:202:b3ff:fe1e:8329"),1);
+ assert_int_equal(ssh_is_ipaddr("fe80::202:b3ff:fe1e:8329"),1);
+
+ assert_int_equal(ssh_is_ipaddr("::ffff:192.0.2.128"),1);
+
assert_int_equal(ssh_is_ipaddr("0.0.0.0.0"),0);
assert_int_equal(ssh_is_ipaddr("0.0.0.0.a"),0);
assert_int_equal(ssh_is_ipaddr("a.0.0.0"),0);