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