numtohost.c revision 1.1.1.6
1#include "config.h"
2
3#include "ntp_stdlib.h"
4#include "ntp_fp.h"
5
6#include "unity.h"
7
8void setUp(void);
9void test_LoopbackNetNonResolve(void);
10
11
12void
13setUp(void)
14{
15	init_lib();
16
17	return;
18}
19
20
21void
22test_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}
32