3 #include "ntp_stdlib.h"
7 void test_NonLeapYearFebruary(void);
8 void test_NonLeapYearJune(void);
9 void test_LeapYearFebruary(void);
10 void test_LeapYearDecember(void);
14 test_NonLeapYearFebruary(void) {
15 TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2010, 2, 20)); //2010-02-20
20 test_NonLeapYearJune(void) {
21 int expected = 31+28+31+30+31+18; // 18 June non-leap year
22 TEST_ASSERT_EQUAL(expected, ymd2yd(2011, 6, 18));
27 test_LeapYearFebruary(void) {
28 TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2012, 2, 20)); //2012-02-20 (leap year)
33 test_LeapYearDecember(void) {
35 int expected = 31+29+31+30+31+30+31+31+30+31+30+31;
36 TEST_ASSERT_EQUAL(expected, ymd2yd(2012, 12, 31));