Skip to content

Commit

Permalink
Avoid implicit integer to double conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Sorbini <asorbini@rti.com>
  • Loading branch information
asorbini committed Mar 5, 2021
1 parent e11986b commit 9de9593
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rclcpp/test/rclcpp/executors/test_multi_threaded_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ TEST_F(TestMultiThreadedExecutor, timer_over_take) {
double diff = static_cast<double>(std::abs((now - last).nanoseconds())) / 1.0e9;
last = now;

if (diff < PERIOD - TOLERANCE) {
double diff_exp =
static_cast<double>(PERIOD) - static_cast<double>(TOLERANCE);
if (diff < diff_exp) {
executor.cancel();
ASSERT_GT(diff, PERIOD - TOLERANCE);
ASSERT_GT(diff, diff_exp);
}

}
};

Expand Down

0 comments on commit 9de9593

Please sign in to comment.