]> CyberLeo.Net >> Repos - FreeBSD/releng/9.3.git/blob - contrib/ntp/tests/libntp/numtohost.c
o Fix invalid TCP checksums with pf(4). [EN-16:02.pf]
[FreeBSD/releng/9.3.git] / contrib / ntp / tests / libntp / numtohost.c
1 #include "config.h"
2
3 #include "ntp_stdlib.h"
4 #include "ntp_fp.h"
5
6 #include "unity.h"
7
8 void setUp(void);
9 void test_LoopbackNetNonResolve(void);
10
11
12 void
13 setUp(void)
14 {
15         init_lib();
16
17         return;
18 }
19
20
21 void
22 test_LoopbackNetNonResolve(void) {
23         /* A loopback address in 127.0.0.0/8 is chosen, and
24          * numtohost() should not try to resolve it unless
25          * it is 127.0.0.1
26          */
27
28         const u_int32 input = 127*256*256*256 + 1*256 + 1; // 127.0.1.1
29
30         TEST_ASSERT_EQUAL_STRING("127.0.1.1", numtohost(htonl(input)));
31 }