From 742cd1564993faefded2d33b6839428a1fe4412a Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sat, 1 Sep 2018 20:56:33 +0300 Subject: Move a check for trailing colon to tor_inet_pton() That way, string_is_valid_ipv6_address() can benefit from it --- src/test/test_util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/test/test_util.c') diff --git a/src/test/test_util.c b/src/test/test_util.c index 6cbd504e34..0921bae109 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -5749,6 +5749,18 @@ test_util_ipv4_validation(void *arg) return; } +static void +test_util_ipv6_validation(void *arg) +{ + (void)arg; + + tt_assert(string_is_valid_ipv6_address("2a00:1450:401b:800::200e")); + tt_assert(!string_is_valid_ipv6_address("11:22::33:44:")); + + done: + return; +} + static void test_util_writepid(void *arg) { @@ -6439,6 +6451,7 @@ struct testcase_t util_tests[] = { UTIL_TEST(hostname_validation, 0), UTIL_TEST(dest_validation_edgecase, 0), UTIL_TEST(ipv4_validation, 0), + UTIL_TEST(ipv6_validation, 0), UTIL_TEST(writepid, 0), UTIL_TEST(get_avail_disk_space, 0), UTIL_TEST(touch_file, 0), -- cgit v1.2.3-54-g00ecf