1 #include "config.h" 2 3 #include "ntp_stdlib.h" 4 #include "ntp_fp.h" 5 6 #include "unity.h" 7 8 void setUp(void); 9 void test_Address(void); 10 void test_Netmask(void); 11 12 13 void 14 setUp(void) 15 { 16 init_lib(); 17 18 return; 19 } 20 21 22 void 23 test_Address(void) { 24 const u_int32 input = htonl(3221225472UL + 512UL + 1UL); // 192.0.2.1 25 26 TEST_ASSERT_EQUAL_STRING("192.0.2.1", numtoa(input)); 27 } 28 29 void 30 test_Netmask(void) { 31 // 255.255.255.0 32 const u_int32 hostOrder = 255UL*256UL*256UL*256UL + 255UL*256UL*256UL + 255UL*256UL; 33 const u_int32 input = htonl(hostOrder); 34 35 TEST_ASSERT_EQUAL_STRING("255.255.255.0", numtoa(input)); 36 } 37