summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp2038
diff options
context:
space:
mode:
authorChirayu Desai <cdesai@cyanogenmod.org>2013-12-05 21:57:14 +0530
committerGedare Bloom <gedare@rtems.org>2013-12-05 11:46:04 -0500
commit262e25075686c73d725dea45a0f2c1e4189ccd76 (patch)
tree5fee0e206c8cbeba97d657b5deac190eb4e6b7f3 /testsuites/sptests/sp2038
parentdoc/posix_users: add notes and descriptions for pthread_key functions (diff)
downloadrtems-262e25075686c73d725dea45a0f2c1e4189ccd76.tar.bz2
sptest: sp2038: Add a test for leap year
Bug test case for PR 1422
Diffstat (limited to 'testsuites/sptests/sp2038')
-rw-r--r--testsuites/sptests/sp2038/init.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuites/sptests/sp2038/init.c b/testsuites/sptests/sp2038/init.c
index e0179e99a3..08a181c4a8 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 ***");