From 226f79b272501537e06079be75abe9eff39349b4 Mon Sep 17 00:00:00 2001 From: Agustin Alba Chicar Date: Thu, 29 Dec 2022 17:57:01 +0100 Subject: [PATCH] Add tests to convert from maliput IDs to ROS messages. Signed-off-by: Agustin Alba Chicar --- .../maliput_ros_translation/convert_test.cc | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/maliput_ros_translation/test/maliput_ros_translation/convert_test.cc b/maliput_ros_translation/test/maliput_ros_translation/convert_test.cc index d1be7c6..594d52c 100644 --- a/maliput_ros_translation/test/maliput_ros_translation/convert_test.cc +++ b/maliput_ros_translation/test/maliput_ros_translation/convert_test.cc @@ -540,6 +540,56 @@ TEST_F(LaneToRosMessageTest, NullLane) { ASSERT_EQ(dut.id.id, kNullLaneId); } +GTEST_TEST(BranchPointIdFromRosMessage, ValidateConversion) { + const std::string kBranchPointId{"branch_point_id"}; + maliput_ros_interfaces::msg::BranchPointId msg; + msg.id = kBranchPointId; + + const maliput::api::BranchPointId dut = FromRosMessage(msg); + + ASSERT_EQ(dut.string(), kBranchPointId); +} + +GTEST_TEST(JunctionIdFromRosMessage, ValidateConversion) { + const std::string kJunctionId{"junction_id"}; + maliput_ros_interfaces::msg::JunctionId msg; + msg.id = kJunctionId; + + const maliput::api::JunctionId dut = FromRosMessage(msg); + + ASSERT_EQ(dut.string(), kJunctionId); +} + +GTEST_TEST(LaneIdFromRosMessage, ValidateConversion) { + const std::string kLaneId{"lane_id"}; + maliput_ros_interfaces::msg::LaneId msg; + msg.id = kLaneId; + + const maliput::api::LaneId dut = FromRosMessage(msg); + + ASSERT_EQ(dut.string(), kLaneId); +} + +GTEST_TEST(RoadGeometryIdFromRosMessage, ValidateConversion) { + const std::string kRoadGeometryId{"road_geometry_id"}; + maliput_ros_interfaces::msg::RoadGeometryId msg; + msg.id = kRoadGeometryId; + + const maliput::api::RoadGeometryId dut = FromRosMessage(msg); + + ASSERT_EQ(dut.string(), kRoadGeometryId); +} + +GTEST_TEST(SegmentIdFromRosMessage, ValidateConversion) { + const std::string kSegmentId{"segment_id"}; + maliput_ros_interfaces::msg::SegmentId msg; + msg.id = kSegmentId; + + const maliput::api::SegmentId dut = FromRosMessage(msg); + + ASSERT_EQ(dut.string(), kSegmentId); +} + } // namespace } // namespace test } // namespace maliput_ros_translation