Skip to content

Commit

Permalink
Revert changes on the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
destogl authored Jan 17, 2024
1 parent fc51d7f commit 024265a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions controller_manager/test/test_controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,16 @@ TEST_P(TestControllerUpdateRates, check_the_controller_update_rate)
time += rclcpp::Duration::from_seconds(0.01);
if (update_counter % cm_update_rate == 0)
{
const double no_of_secs_passed = static_cast<double>(update_counter) / cm_update_rate;
const auto no_of_secs_passed = update_counter / cm_update_rate;
// NOTE: here EXPECT_NEAR is used because it is observed that in the first iteration of whole
// cycle of cm_update_rate counts, there is one count missing, but in rest of the 9 cycles it
// is clearly tracking, so adding 1 here won't affect the final count.
// For instance, a controller with update rate 37 Hz, seems to have 36 in the first update
// cycle and then on accumulating 37 on every other update cycle so at the end of the 10
// cycles it will have 369 instead of 370.
EXPECT_THAT(
EXPECT_NEAR(
test_controller->internal_counter - initial_counter,
testing::AnyOf(
testing::Eq(controller_update_rate * no_of_secs_passed),
testing::Eq((controller_update_rate * no_of_secs_passed) - 1)));
(controller_update_rate * no_of_secs_passed), 1);
}
}
}
Expand Down

0 comments on commit 024265a

Please sign in to comment.