chiark / gitweb /
rename recentact to lowvol
[inn-innduct.git] / tests / lib / inet_ntoa-t.c
1 /* $Id: inet_ntoa-t.c 5061 2001-12-12 09:21:17Z rra $ */
2 /* inet_ntoa test suite. */
3
4 #include "config.h"
5 #include "clibrary.h"
6 #include <netinet/in.h>
7
8 #include "libtest.h"
9
10 const char *test_inet_ntoa(const struct in_addr);
11
12 static void
13 test_addr(int n, const char *expected, unsigned long addr)
14 {
15     struct in_addr in;
16
17     in.s_addr = htonl(addr);
18     ok_string(n, expected, test_inet_ntoa(in));
19 }
20
21 int
22 main(void)
23 {
24     puts("5");
25
26     test_addr(1,         "0.0.0.0", 0x0);
27     test_addr(2,       "127.0.0.0", 0x7f000000UL);
28     test_addr(3, "255.255.255.255", 0xffffffffUL);
29     test_addr(4, "172.200.232.199", 0xacc8e8c7UL);
30     test_addr(5,         "1.2.3.4", 0x01020304UL);
31
32     return 0;
33 }