Skip to content

Commit

Permalink
Addressed TODO in test_local_parameters (#545)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
  • Loading branch information
ahcorde authored Apr 15, 2024
1 parent b18cfda commit 08da25b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test_rclcpp/test/test_local_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ TEST_F(test_local_parameters, to_string)
json_dict.c_str());

pv = rclcpp::Parameter("foo", 2.1);
// TODO(tfoote) convert the value to a float and use epsilon test.
EXPECT_STREQ(
"{\"name\": \"foo\", \"type\": \"double\", \"value\": \"2.100000\"}",
std::to_string(pv).c_str());
EXPECT_NEAR(pv.as_double(), 2.1, 1e-6f);
pv = rclcpp::Parameter("foo", 8);
EXPECT_STREQ(
"{\"name\": \"foo\", \"type\": \"integer\", \"value\": \"8\"}",
std::to_string(pv).c_str());
EXPECT_EQ(pv.as_int(), 8);
}

TEST_F(test_local_parameters, local_synchronous)
Expand Down

0 comments on commit 08da25b

Please sign in to comment.