summaryrefslogtreecommitdiff
path: root/tests/check_ipaddrcheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/check_ipaddrcheck.c')
-rw-r--r--tests/check_ipaddrcheck.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/tests/check_ipaddrcheck.c b/tests/check_ipaddrcheck.c
index 3b260c2..ebae1e1 100644
--- a/tests/check_ipaddrcheck.c
+++ b/tests/check_ipaddrcheck.c
@@ -405,17 +405,31 @@ END_TEST
START_TEST (test_is_ipv4_range)
{
- ck_assert_int_eq(is_ipv4_range("192.0.2.0-192.0.2.10", 0), RESULT_SUCCESS);
- ck_assert_int_eq(is_ipv4_range("192.0.2.-", 0), RESULT_FAILURE);
- ck_assert_int_eq(is_ipv4_range("192.0.2.99-192.0.2.11", 0), RESULT_FAILURE);
+ ck_assert_int_eq(is_ipv4_range("192.0.2.0-192.0.2.10", 0, 1), RESULT_SUCCESS);
+ ck_assert_int_eq(is_ipv4_range("192.0.2.-", 0, 1), RESULT_FAILURE);
+ ck_assert_int_eq(is_ipv4_range("192.0.2.99-192.0.2.11", 0, 1), RESULT_FAILURE);
+}
+END_TEST
+
+START_TEST (test_is_ipv4_range_prefix)
+{
+ ck_assert_int_eq(is_ipv4_range("192.0.2.0-192.0.2.10", 24, 1), RESULT_SUCCESS);
+ ck_assert_int_eq(is_ipv4_range("10.0.1.1-10.0.2.1", 24, 1), RESULT_FAILURE);
}
END_TEST
START_TEST (test_is_ipv6_range)
{
- ck_assert_int_eq(is_ipv6_range("2001:db8::1-2001:db8::20", 0), RESULT_SUCCESS);
- ck_assert_int_eq(is_ipv6_range("2001:-", 0), RESULT_FAILURE);
- ck_assert_int_eq(is_ipv6_range("2001:db8::99-2001:db8:1", 0), RESULT_FAILURE);
+ ck_assert_int_eq(is_ipv6_range("2001:db8::1-2001:db8::20", 0, 1), RESULT_SUCCESS);
+ ck_assert_int_eq(is_ipv6_range("2001:-", 0, 1), RESULT_FAILURE);
+ ck_assert_int_eq(is_ipv6_range("2001:db8::99-2001:db8:1", 0, 1), RESULT_FAILURE);
+}
+END_TEST
+
+START_TEST (test_is_ipv6_range_prefix)
+{
+ ck_assert_int_eq(is_ipv6_range("2001:db8::1-2001:db8::20", 64, 1), RESULT_SUCCESS);
+ ck_assert_int_eq(is_ipv6_range("2001:db8:aaaa::1-2001:db8:bbbb::1", 64, 1), RESULT_FAILURE);
}
END_TEST