summaryrefslogtreecommitdiff
path: root/tests/libntp/numtohost.cpp
blob: ffc574ee85b3119791aa5f52c6b358190534218d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "libntptest.h"

class numtohostTest : public libntptest {
};

TEST_F(numtohostTest, LoopbackNetNonResolve) {
	/* A loopback address in 127.0.0.0/8 is chosen, and
	 * numtohost() should not try to resolve it unless
	 * it is 127.0.0.1
	 */

	u_int32 input = 127*256*256*256 + 1*256 + 1; // 127.0.1.1
	
	EXPECT_STREQ("127.0.1.1", numtohost(htonl(input)));
}