Skip to content

Commit

Permalink
Merge branch 'master' into jtc_tolerance_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich authored Jul 18, 2023
2 parents 6042dd3 + 3c7072e commit a4f00cb
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 @@ -65,10 +65,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 @@ -456,9 +456,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 a4f00cb

Please sign in to comment.