]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/tests/libntp/g_numtoa.cpp
Fix a regression with SA-15:24 patch that prevented NIS from
[FreeBSD/releng/10.2.git] / contrib / ntp / tests / libntp / g_numtoa.cpp
1 #include "g_libntptest.h"
2
3 class numtoaTest : public libntptest {
4 };
5
6 TEST_F(numtoaTest, Address) {
7         u_int32 input = htonl(3221225472UL+512UL+1UL); // 192.0.2.1
8
9         EXPECT_STREQ("192.0.2.1", numtoa(input));
10 }
11
12 TEST_F(numtoaTest, Netmask) {
13         // 255.255.255.0
14         u_int32 hostOrder = 255UL*256UL*256UL*256UL + 255UL*256UL*256UL + 255UL*256UL;
15         u_int32 input = htonl(hostOrder);
16
17         EXPECT_STREQ("255.255.255.0", numtoa(input));
18 }