Skip to content

Commit 095bd0f

Browse files
committed
Add const qualifier to constants
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
1 parent 7ba92dd commit 095bd0f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

rclcpp/test/rclcpp/test_time.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ TEST_F(TestTime, seconds) {
356356
}
357357

358358
TEST_F(TestTime, test_max) {
359-
rclcpp::Time time_max = rclcpp::Time::max();
360-
rclcpp::Time max_time(std::numeric_limits<int32_t>::max(), 999999999);
359+
const rclcpp::Time time_max = rclcpp::Time::max();
360+
const rclcpp::Time max_time(std::numeric_limits<int32_t>::max(), 999999999);
361361
EXPECT_DOUBLE_EQ(max_time.seconds(), time_max.seconds());
362362
EXPECT_EQ(max_time.nanoseconds(), time_max.nanoseconds());
363363
}
@@ -369,7 +369,7 @@ TEST_F(TestTime, test_constructor_from_rcl_time_point) {
369369
test_time_point.nanoseconds = test_nano_seconds;
370370
test_time_point.clock_type = test_clock_type;
371371

372-
rclcpp::Time time_max = rclcpp::Time(test_time_point);
372+
const rclcpp::Time time_max = rclcpp::Time(test_time_point);
373373

374374
EXPECT_EQ(test_nano_seconds, time_max.nanoseconds());
375375
EXPECT_EQ(test_nano_seconds, test_time_point.nanoseconds);
@@ -379,7 +379,7 @@ TEST_F(TestTime, test_constructor_from_rcl_time_point) {
379379

380380
TEST_F(TestTime, test_assignment_operator_from_builtin_msg_time) {
381381
rclcpp::Clock ros_clock(RCL_ROS_TIME);
382-
builtin_interfaces::msg::Time ros_now = ros_clock.now();
382+
const builtin_interfaces::msg::Time ros_now = ros_clock.now();
383383
EXPECT_NE(0, ros_now.sec);
384384
EXPECT_NE(0u, ros_now.nanosec);
385385

@@ -394,11 +394,11 @@ TEST_F(TestTime, test_assignment_operator_from_builtin_msg_time) {
394394
}
395395

396396
TEST_F(TestTime, test_sum_operator) {
397-
rclcpp::Duration one(1);
398-
rclcpp::Time test_time(0u);
397+
const rclcpp::Duration one(1);
398+
const rclcpp::Time test_time(0u);
399399
EXPECT_EQ(0u, test_time.nanoseconds());
400400

401-
rclcpp::Time new_time = one + test_time;
401+
const rclcpp::Time new_time = one + test_time;
402402
EXPECT_EQ(1, new_time.nanoseconds());
403403
}
404404

0 commit comments

Comments
 (0)