Skip to content

Commit

Permalink
Activate AdmittanceControllerTestParameterizedInvalidParameters (#711)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3c7072e)
  • Loading branch information
christophfroehlich authored and mergify[bot] committed Aug 3, 2023
1 parent e5b99ab commit e365f14
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
16 changes: 12 additions & 4 deletions admittance_controller/test/test_admittance_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ INSTANTIATE_TEST_SUITE_P(
// wrong length selected axes
std::make_tuple(
std::string("admittance.selected_axes"),
rclcpp::ParameterValue(std::vector<double>() = {1, 2, 3})),
// invalid robot description
std::make_tuple(
std::string("robot_description"), rclcpp::ParameterValue(std::string() = "bad_robot"))));
rclcpp::ParameterValue(std::vector<double>() = {1, 2, 3}))
// invalid robot description.
// TODO(anyone): deactivated, because SetUpController returns SUCCESS here?
// ,std::make_tuple(
// std::string("robot_description"), rclcpp::ParameterValue(std::string() = "bad_robot")))
));

// Test on_init returns ERROR when a parameter is invalid
TEST_P(AdmittanceControllerTestParameterizedInvalidParameters, invalid_parameters)
{
ASSERT_EQ(SetUpController(), controller_interface::return_type::ERROR);
}

TEST_F(AdmittanceControllerTest, all_parameters_set_configure_success)
{
Expand Down
10 changes: 8 additions & 2 deletions admittance_controller/test/test_admittance_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,15 @@ class AdmittanceControllerTestParameterizedInvalidParameters
static void TearDownTestCase() { AdmittanceControllerTest::TearDownTestCase(); }

protected:
void SetUpController()
controller_interface::return_type SetUpController()
{
AdmittanceControllerTest::SetUpController("test_admittance_controller");
auto param_name = std::get<0>(GetParam());
auto param_value = std::get<1>(GetParam());
std::vector<rclcpp::Parameter> parameter_overrides;
rclcpp::Parameter param(param_name, param_value);
parameter_overrides.push_back(param);
return AdmittanceControllerTest::SetUpController(
"test_admittance_controller", parameter_overrides);
}
};

Expand Down

0 comments on commit e365f14

Please sign in to comment.