1 #include "config.h"
2 #include "ntp_stdlib.h"
3 #include "ntp_fp.h"
4 #include "caltime.h"
5
6 #include "unity.h"
7 #include "unity_fixture.h"
8
9 TEST_GROUP(prettydate);
10
TEST_SETUP(prettydate)11 TEST_SETUP(prettydate) {
12 set_prettydate_pivot(settime(2000, 1, 1, 0, 0, 0));
13 }
14
TEST_TEAR_DOWN(prettydate)15 TEST_TEAR_DOWN(prettydate) {}
16
17
18 #include "ntp_fp.h"
19
20 static const uint32_t HALF = 2147483648UL;
21
TEST(prettydate,Rfc3339Date1)22 TEST(prettydate, Rfc3339Date1) {
23 TEST_ASSERT_EQUAL_STRING("2036-02-07T06:28:16.000Z", rfc3339date(0));
24 }
25
TEST(prettydate,Rfc3339Time1)26 TEST(prettydate, Rfc3339Time1) {
27 TEST_ASSERT_EQUAL_STRING("2036-02-07T06:28:16.000Z", rfc3339date(0));
28 }
29
TEST(prettydate,ConstantDate)30 TEST(prettydate, ConstantDate) {
31 l_fp t = lfpinit((int32_t)3485080800LL, HALF); // 2010-06-09 14:00:00.5
32
33 TEST_ASSERT_EQUAL_STRING("cfba1ce0.80000000 2010-06-09T14:00:00.500Z", prettydate(t));
34 }
35
TEST_GROUP_RUNNER(prettydate)36 TEST_GROUP_RUNNER(prettydate) {
37 RUN_TEST_CASE(prettydate, ConstantDate);
38 RUN_TEST_CASE(prettydate, Rfc3339Date1);
39 RUN_TEST_CASE(prettydate, Rfc3339Time1);
40 }
41