1#include "config.h" 2 3#include "ntp_stdlib.h" 4 5#include "unity.h" 6 7void test_NonLeapYearFebruary(void); 8void test_NonLeapYearJune(void); 9void test_LeapYearFebruary(void); 10void test_LeapYearDecember(void); 11 12 13void 14test_NonLeapYearFebruary(void) { 15 TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2010, 2, 20)); //2010-02-20 16} 17 18 19void 20test_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)); 23} 24 25 26void 27test_LeapYearFebruary(void) { 28 TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2012, 2, 20)); //2012-02-20 (leap year) 29} 30 31 32void 33test_LeapYearDecember(void) { 34 // 2012-12-31 35 int expected = 31+29+31+30+31+30+31+31+30+31+30+31; 36 TEST_ASSERT_EQUAL(expected, ymd2yd(2012, 12, 31)); 37} 38