1 /* $NetBSD: numtoa.c,v 1.1.1.3 2015/10/23 17:47:45 christos Exp $ */ 2 3 #include "config.h" 4 5 #include "ntp_stdlib.h" 6 #include "ntp_fp.h" 7 8 #include "unity.h" 9 10 void test_Address(void); 11 void test_Netmask(void); 12 13 void 14 test_Address(void) { 15 const u_int32 input = htonl(3221225472UL + 512UL + 1UL); // 192.0.2.1 16 17 TEST_ASSERT_EQUAL_STRING("192.0.2.1", numtoa(input)); 18 } 19 20 void 21 test_Netmask(void) { 22 // 255.255.255.0 23 const u_int32 hostOrder = 255UL*256UL*256UL*256UL + 255UL*256UL*256UL + 255UL*256UL; 24 const u_int32 input = htonl(hostOrder); 25 26 TEST_ASSERT_EQUAL_STRING("255.255.255.0", numtoa(input)); 27 } 28