From 46353ff29e7a3e38d151f91cb2b5633309ea9c52 Mon Sep 17 00:00:00 2001 From: Jorge Perez Date: Tue, 14 Apr 2020 11:50:05 -0300 Subject: [PATCH] Add test to get_time_since_last_call Signed-off-by: Jorge Perez --- rcl/test/rcl/test_timer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rcl/test/rcl/test_timer.cpp b/rcl/test/rcl/test_timer.cpp index 86843fcc0..956714ae6 100644 --- a/rcl/test/rcl/test_timer.cpp +++ b/rcl/test/rcl/test_timer.cpp @@ -682,3 +682,11 @@ TEST_F(TestPreInitTimer, test_timer_get_period) { EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_timer_get_period(nullptr, &period)); EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_timer_get_period(&timer, nullptr)); } + +TEST_F(TestPreInitTimer, test_time_since_last_call) { + rcl_time_point_value_t time_sice_next_call_start, time_sice_next_call_end; + + ASSERT_EQ(RCL_RET_OK, rcl_timer_get_time_since_last_call(&timer, &time_sice_next_call_start)); + ASSERT_EQ(RCL_RET_OK, rcl_timer_get_time_since_last_call(&timer, &time_sice_next_call_end)); + EXPECT_GT(time_sice_next_call_end, time_sice_next_call_start); +}