Changeset 262e250 in rtems


Ignore:
Timestamp:
12/05/13 16:27:14 (10 years ago)
Author:
Chirayu Desai <cdesai@…>
Branches:
4.11, 5, master
Children:
8ed1a54c
Parents:
98b9a3b
git-author:
Chirayu Desai <cdesai@…> (12/05/13 16:27:14)
git-committer:
Gedare Bloom <gedare@…> (12/05/13 16:46:04)
Message:

sptest: sp2038: Add a test for leap year

Bug test case for PR 1422

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/sp2038/init.c

    r98b9a3b r262e250  
    190190};
    191191
     192static const rtems_time_of_day problem_2100 = {
     193  .year = 2100,
     194  .month = 2,
     195  .day = 28,
     196  .hour = 0,
     197  .minute = 0,
     198  .second = 0
     199};
     200
     201static const rtems_time_of_day problem_2100_2 = {
     202  .year = 2100,
     203  .month = 2,
     204  .day = 29,
     205  .hour = 0,
     206  .minute = 0,
     207  .second = 0
     208};
     209
    192210static void test_tod_to_seconds(void)
    193211{
     
    252270}
    253271
     272static void test_leap_year(void)
     273{
     274    bool test_status;
     275    const rtems_time_of_day *problem = &problem_2100;
     276    const rtems_time_of_day *problem2 = &problem_2100_2;
     277    // 2100 is not a leap year, so it should have 28 days
     278    test_status = _TOD_Validate(problem);
     279    rtems_test_assert(test_status == true);
     280    test_status = _TOD_Validate(problem2);
     281    rtems_test_assert(test_status == false);
     282}
     283
     284
    254285rtems_task Init(rtems_task_argument argument)
    255286{
     
    258289  test_tod_to_seconds();
    259290  test_problem_year();
     291  test_leap_year();
    260292
    261293  puts("*** END OF TEST 2038 ***");
Note: See TracChangeset for help on using the changeset viewer.