aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests
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:16:06 +0100
commit5d4bd5a21d9b903341c175696b0c747076672572 (patch)
treee0de50da8dbfbde75e204cd24e57657e0e85eb3b /tests/unittests
parente8c3f5575173f2d0f0258992574ea3d5352fcf43 (diff)
downloadlibssh-5d4bd5a21d9b903341c175696b0c747076672572.tar.gz
libssh-5d4bd5a21d9b903341c175696b0c747076672572.tar.xz
libssh-5d4bd5a21d9b903341c175696b0c747076672572.zip
tests: Added ipv6 tests.
Diffstat (limited to 'tests/unittests')
-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);