]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/tests/libntp/ymd2yd.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / tests / libntp / ymd2yd.c
1 #include "config.h"
2
3 #include "ntp_stdlib.h"
4 #include "ntp_calendar.h"
5
6 #include "unity.h"
7
8 void setUp(void)
9
10 }
11
12 void tearDown(void)
13 {
14 }
15
16
17 void test_NonLeapYearFebruary (void) {
18         TEST_ASSERT_EQUAL(31+20, ymd2yd(2010,2,20)); //2010-02-20
19 }
20
21 void 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
26 void test_LeapYearFebruary (void) {
27         TEST_ASSERT_EQUAL(31+20, ymd2yd(2012,2,20)); //2012-02-20 (leap year)
28 }
29
30 void 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