#include "config.h"
#include "ntp_calendar.h"
#include "unity.h"
void test_DateGivenMonthDay(void);
void test_DateGivenYearDay(void);
void test_DateLeapYear(void);
void test_WraparoundDateIn2036(void);
void
test_DateGivenMonthDay(void) {
struct calendar input = {2010, 0, 6, 24, 12, 50, 0};
u_long expected = 3486372600UL;
TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input));
}
void
test_DateGivenYearDay(void) {
struct calendar input = {2010, 175, 0, 0, 12, 50, 0};
u_long expected = 3486372600UL;
TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input));
}
void
test_DateLeapYear(void) {
struct calendar inputYd = {2012, 176, 0, 0, 12, 00, 00};
struct calendar inputMd = {2012, 0, 6, 24, 12, 00, 00};
u_long expected = 3549528000UL;
TEST_ASSERT_EQUAL_UINT(expected, caltontp(&inputYd));
TEST_ASSERT_EQUAL_UINT(expected, caltontp(&inputMd));
}
void
test_WraparoundDateIn2036(void) {
struct calendar input = {2036, 0, 2, 7, 6, 28, 16};
u_long expected = 0UL;
TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input));
}