1/*	$NetBSD: numtohost.c,v 1.2 2020/05/25 20:47:36 christos Exp $	*/
2
3#include "config.h"
4
5#include "ntp_stdlib.h"
6#include "ntp_fp.h"
7
8#include "unity.h"
9
10void setUp(void);
11void test_LoopbackNetNonResolve(void);
12
13
14void
15setUp(void)
16{
17	init_lib();
18
19	return;
20}
21
22
23void
24test_LoopbackNetNonResolve(void) {
25	/* A loopback address in 127.0.0.0/8 is chosen, and
26	 * numtohost() should not try to resolve it unless
27	 * it is 127.0.0.1
28	 */
29
30	const u_int32 input = 127*256*256*256 + 1*256 + 1; // 127.0.1.1
31
32	TEST_ASSERT_EQUAL_STRING("127.0.1.1", numtohost(htonl(input)));
33}
34