[rtems commit] sptest: sp2038: Add a test for leap year
Gedare Bloom
gedare at rtems.org
Thu Dec 5 16:42:50 UTC 2013
Module: rtems
Branch: master
Commit: 262e25075686c73d725dea45a0f2c1e4189ccd76
Changeset: http://git.rtems.org/rtems/commit/?id=262e25075686c73d725dea45a0f2c1e4189ccd76
Author: Chirayu Desai <cdesai at cyanogenmod.org>
Date: Thu Dec 5 22:15:14 2013 +0530
sptest: sp2038: Add a test for leap year
Bug test case for PR 1422
---
testsuites/sptests/sp2038/init.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/testsuites/sptests/sp2038/init.c b/testsuites/sptests/sp2038/init.c
index e0179e9..08a181c 100644
--- a/testsuites/sptests/sp2038/init.c
+++ b/testsuites/sptests/sp2038/init.c
@@ -189,6 +189,24 @@ static const rtems_time_of_day problem_2106 = {
.second = 16
};
+static const rtems_time_of_day problem_2100 = {
+ .year = 2100,
+ .month = 2,
+ .day = 28,
+ .hour = 0,
+ .minute = 0,
+ .second = 0
+};
+
+static const rtems_time_of_day problem_2100_2 = {
+ .year = 2100,
+ .month = 2,
+ .day = 29,
+ .hour = 0,
+ .minute = 0,
+ .second = 0
+};
+
static void test_tod_to_seconds(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
@@ -251,12 +269,26 @@ static void test_problem_year(void)
#endif /* TEST_APPLICABLE */
}
+static void test_leap_year(void)
+{
+ bool test_status;
+ const rtems_time_of_day *problem = &problem_2100;
+ const rtems_time_of_day *problem2 = &problem_2100_2;
+ // 2100 is not a leap year, so it should have 28 days
+ test_status = _TOD_Validate(problem);
+ rtems_test_assert(test_status == true);
+ test_status = _TOD_Validate(problem2);
+ rtems_test_assert(test_status == false);
+}
+
+
rtems_task Init(rtems_task_argument argument)
{
puts("\n\n*** TEST 2038 ***");
test_tod_to_seconds();
test_problem_year();
+ test_leap_year();
puts("*** END OF TEST 2038 ***");
More information about the vc
mailing list