From 67b4c0a6f7eaf8bf85ec2892d7bfb7563db99b42 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Sat, 19 Oct 2013 23:16:33 +0000 Subject: [PATCH] add an inet_pton regression test --- src/regression/inet_pton-invalid-address.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/regression/inet_pton-invalid-address.c diff --git a/src/regression/inet_pton-invalid-address.c b/src/regression/inet_pton-invalid-address.c new file mode 100644 index 0000000..7f181f4 --- /dev/null +++ b/src/regression/inet_pton-invalid-address.c @@ -0,0 +1,14 @@ +// inet_pton should return 0 on invalid address format +#include +#include +#include "test.h" + +int main(void) +{ + int r; + char addr[16]; + + if ((r=inet_pton(AF_INET6, "192.168.1.1", addr)) != 0) + t_error("inet_pton(AF_INET6, \"192.168.1.1\", addr) should return 0, got %d\n", r); + return t_status; +} -- 2.20.1