ymd2yd.c revision 1.1.1.1
1#include "config.h"
2
3#include "ntp_stdlib.h"
4#include "ntp_calendar.h"
5
6#include "unity.h"
7
8void setUp(void)
9{
10}
11
12void tearDown(void)
13{
14}
15
16
17void test_NonLeapYearFebruary (void) {
18	TEST_ASSERT_EQUAL(31+20, ymd2yd(2010,2,20)); //2010-02-20
19}
20
21void test_NonLeapYearJune (void) {
22	int expected = 31+28+31+30+31+18; // 18 June non-leap year
23	TEST_ASSERT_EQUAL(expected, ymd2yd(2011,6,18));
24}
25
26void test_LeapYearFebruary (void) {
27	TEST_ASSERT_EQUAL(31+20, ymd2yd(2012,2,20)); //2012-02-20 (leap year)
28}
29
30void test_LeapYearDecember (void) {
31	// 2012-12-31
32	int expected = 31+29+31+30+31+30+31+31+30+31+30+31;
33	TEST_ASSERT_EQUAL(expected, ymd2yd(2012,12,31));
34}
35
36