aboutsummaryrefslogtreecommitdiff
path: root/tests/libntp/numtoa.c
blob: 1d01c78438561946ecfe894a58e7396c50d2455b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "config.h"

#include "ntp_stdlib.h"
#include "ntp_calendar.h"
#include "ntp_fp.h"

#include "unity.h"


void setUp(void)
{ 
}

void tearDown(void)
{
}

void test_Address(void) {
        u_int32 input = htonl(3221225472UL+512UL+1UL); // 192.0.2.1

        TEST_ASSERT_EQUAL_STRING("192.0.2.1", numtoa(input));
}

void test_Netmask(void) {
        // 255.255.255.0
        u_int32 hostOrder = 255UL*256UL*256UL*256UL + 255UL*256UL*256UL + 255UL*256UL;
        u_int32 input = htonl(hostOrder);

        TEST_ASSERT_EQUAL_STRING("255.255.255.0", numtoa(input));
}