]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/tests/libntp/numtoa.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / tests / libntp / numtoa.c
1 #include "config.h"
2
3 #include "ntp_stdlib.h"
4 #include "ntp_calendar.h"
5 #include "ntp_fp.h"
6
7 #include "unity.h"
8
9
10 void setUp(void)
11
12 }
13
14 void tearDown(void)
15 {
16 }
17
18 void test_Address(void) {
19         u_int32 input = htonl(3221225472UL+512UL+1UL); // 192.0.2.1
20
21         TEST_ASSERT_EQUAL_STRING("192.0.2.1", numtoa(input));
22 }
23
24 void test_Netmask(void) {
25         // 255.255.255.0
26         u_int32 hostOrder = 255UL*256UL*256UL*256UL + 255UL*256UL*256UL + 255UL*256UL;
27         u_int32 input = htonl(hostOrder);
28
29         TEST_ASSERT_EQUAL_STRING("255.255.255.0", numtoa(input));
30 }
31