1284990Scy#include "config.h"
2284990Scy
3284990Scy#include "ntp_stdlib.h"
4284990Scy
5284990Scy#include "unity.h"
6284990Scy
7289999Sglebiusvoid test_NonLeapYearFebruary(void);
8289999Sglebiusvoid test_NonLeapYearJune(void);
9289999Sglebiusvoid test_LeapYearFebruary(void);
10289999Sglebiusvoid test_LeapYearDecember(void);
11284990Scy
12289999Sglebius
13289999Sglebiusvoid
14289999Sglebiustest_NonLeapYearFebruary(void) {
15289999Sglebius	TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2010, 2, 20)); //2010-02-20
16284990Scy}
17284990Scy
18284990Scy
19289999Sglebiusvoid
20289999Sglebiustest_NonLeapYearJune(void) {
21284990Scy	int expected = 31+28+31+30+31+18; // 18 June non-leap year
22289999Sglebius	TEST_ASSERT_EQUAL(expected, ymd2yd(2011, 6, 18));
23284990Scy}
24284990Scy
25289999Sglebius
26289999Sglebiusvoid
27289999Sglebiustest_LeapYearFebruary(void) {
28289999Sglebius	TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2012, 2, 20)); //2012-02-20 (leap year)
29284990Scy}
30284990Scy
31289999Sglebius
32289999Sglebiusvoid
33289999Sglebiustest_LeapYearDecember(void) {
34284990Scy	// 2012-12-31
35284990Scy	int expected = 31+29+31+30+31+30+31+31+30+31+30+31;
36289999Sglebius	TEST_ASSERT_EQUAL(expected, ymd2yd(2012, 12, 31));
37284990Scy}
38