]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/ntp/tests/libntp/g_numtoa.cpp
MFC r280849,280915-280916,281015-281016,282097,282408,282415,283542,
[FreeBSD/stable/10.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 }