summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2018-09-01 20:56:33 +0300
committerNick Mathewson <nickm@torproject.org>2018-10-30 09:05:11 -0400
commit742cd1564993faefded2d33b6839428a1fe4412a (patch)
treee1342212d387ccccedf2940dd3a48b316ca8e5f3 /src/test/test_util.c
parent1baa2703c36cf964d5fc1f07433196e8ccc0e55a (diff)
downloadtor-742cd1564993faefded2d33b6839428a1fe4412a.tar.gz
tor-742cd1564993faefded2d33b6839428a1fe4412a.zip
Move a check for trailing colon to tor_inet_pton()
That way, string_is_valid_ipv6_address() can benefit from it
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c13
1 files changed, 13 insertions, 0 deletions
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
@@ -5750,6 +5750,18 @@ test_util_ipv4_validation(void *arg)
}
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)
{
(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),