3 #include "ntp_stdlib.h" //test fail without this include, for some reason
4 #include "ntp_calendar.h"
7 #include "test-libntp.h"
12 ntpcal_set_timefunc(timefunc);
13 settime(1970, 1, 1, 0, 0, 0);
18 ntpcal_set_timefunc(NULL);
22 void test_NoWrapInDateRange() {
23 const u_int32 input = 3486372600UL; // 2010-06-24 12:50:00.
24 const u_int32 expected = 3471292800UL; // 2010-01-01 00:00:00
26 TEST_ASSERT_EQUAL(expected, calyearstart(input, &nowtime));
27 TEST_ASSERT_EQUAL(expected, calyearstart(input, NULL));
30 void test_NoWrapInDateRangeLeapYear() {
31 const u_int32 input = 3549528000UL; // 2012-06-24 12:00:00
32 const u_int32 expected = 3534364800UL; // 2012-01-01 00:00:00
34 TEST_ASSERT_EQUAL(expected, calyearstart(input, &nowtime));
35 TEST_ASSERT_EQUAL(expected, calyearstart(input, NULL));
38 void test_WrapInDateRange() {
39 const u_int32 input = 19904UL; // 2036-02-07 12:00:00
40 const u_int32 expected = 4291747200UL; // 2036-01-01 00:00:00
42 TEST_ASSERT_EQUAL(expected, calyearstart(input, &nowtime));
43 TEST_ASSERT_EQUAL(expected, calyearstart(input, NULL));