sptimespec01 : Add test case to sptimespec01 which uses a > 32-bit time

the commit adds a test case to test rtems-timespec_add_to  which uses a > 32-bit time.
closes #5146
This commit is contained in:
zak liang
2024-11-12 21:55:29 -05:00
committed by Kinsey Moore
parent c7912a997b
commit cc4123136b
2 changed files with 20 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ void test_compare(void);
void test_validity(void); void test_validity(void);
void test_subtract(void); void test_subtract(void);
void test_convert(void); void test_convert(void);
void test_greaterthan32bits(void);
struct timespec *timespec1; struct timespec *timespec1;
struct timespec *timespec2; struct timespec *timespec2;
@@ -70,12 +71,29 @@ rtems_task Init(
test_validity(); test_validity();
test_subtract(); test_subtract();
test_convert(); test_convert();
test_greaterthan32bits();
TEST_END(); TEST_END();
rtems_test_exit(0); rtems_test_exit(0);
} }
void test_greaterthan32bits()
{
/* Basic test to see if addition works with a value greater than 32 bits */
time_t returned_timeT;
rtems_timespec_set( timespec1, 4294967296LL, 1 );
rtems_timespec_set( timespec2, 1, 1 );
returned_timeT = rtems_timespec_add_to( timespec1, timespec2 );
rtems_test_assert(
returned_timeT == rtems_timespec_add_to( timespec1, timespec2 )
);
puts("rtems_timespec_add_to test greater than 32 bits PASSED");
}
void test_add(){ void test_add(){
/* Basic add_to test. tv_nsec in result is in range /* Basic add_to test. tv_nsec in result is in range
* (less than TOD_NANOSECONDS_PER_SECOND) */ * (less than TOD_NANOSECONDS_PER_SECOND) */

View File

@@ -9,5 +9,6 @@
rtems_timespec_subtract test PASSED rtems_timespec_subtract test PASSED
rtems_timespec_from_ticks PASSED rtems_timespec_from_ticks PASSED
rtems_timespec_from_ticks and rtems_timespec_to_ticks test PASSED rtems_timespec_from_ticks and rtems_timespec_to_ticks test PASSED
rtems_timespec_add_to test greater than 32 bits PASSED
*** END OF TEST sptimespec01 *** *** END OF TEST sptimespec01 ***