Skip to content

Commit

Permalink
Add comments to test code
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Jan 7, 2024
1 parent 21c889e commit 5f90914
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions hardware_interface/test/test_component_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,15 +775,22 @@ TEST_F(TestComponentParser, gripper_mimic_false_valid_config)
ASSERT_THAT(hw_info[0].mimic_joints, SizeIs(0));
}

TEST_F(TestComponentParser, urdf_two_base_links_throws_error)
/**
* @brief Test that the parser throws an error if the URDF contains a link with no parent.
*/
TEST_F(TestComponentParser, urdf_two_root_links_throws_error)
{
const auto urdf_to_test =
std::string(ros2_control_test_assets::gripper_urdf_head_two_base_links) +
std::string(ros2_control_test_assets::gripper_urdf_head_invalid_two_root_links) +
std::string(ros2_control_test_assets::gripper_hardware_resources_mimic_true_no_command_if) +
std::string(ros2_control_test_assets::urdf_tail);
ASSERT_THROW(parse_control_resources_from_urdf(urdf_to_test), std::runtime_error);
}

/**
* @brief Test that the parser throws an error if a joint defined in the ros2_control tag is missing
* in the URDF
*/
TEST_F(TestComponentParser, urdf_incomplete_throws_error)
{
const auto urdf_to_test =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ const auto gripper_urdf_head_incomplete =
</joint>
)";

const auto gripper_urdf_head_two_base_links =
const auto gripper_urdf_head_invalid_two_root_links =
R"(<?xml version="1.0" ?>
<robot name="gripper">
<link name="world"/>
Expand Down

0 comments on commit 5f90914

Please sign in to comment.