add an inet_pton regression test
authorSzabolcs Nagy <nsz@port70.net>
Sat, 19 Oct 2013 23:16:33 +0000 (23:16 +0000)
committerSzabolcs Nagy <nsz@port70.net>
Sat, 19 Oct 2013 23:16:33 +0000 (23:16 +0000)
src/regression/inet_pton-invalid-address.c [new file with mode: 0644]

diff --git a/src/regression/inet_pton-invalid-address.c b/src/regression/inet_pton-invalid-address.c
new file mode 100644 (file)
index 0000000..7f181f4
--- /dev/null
@@ -0,0 +1,14 @@
+// inet_pton should return 0 on invalid address format
+#include <string.h>
+#include <arpa/inet.h>
+#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;
+}