Skip to content

Change to ament_add_gmock in joint_limits #2165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion joint_limits/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ if(BUILD_TESTING)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)

ament_add_gmock_executable(joint_limits_rosparam_test test/joint_limits_rosparam_test.cpp)
ament_add_gmock(joint_limits_rosparam_test test/joint_limits_rosparam_test.cpp)
target_link_libraries(joint_limits_rosparam_test joint_limits)
target_compile_definitions(
joint_limits_rosparam_test
PRIVATE PARAMETERS_FILE_PATH="${CMAKE_CURRENT_LIST_DIR}/test/")

ament_add_gmock(joint_limits_urdf_test test/joint_limits_urdf_test.cpp)
target_link_libraries(joint_limits_urdf_test joint_limits)
Expand Down
24 changes: 22 additions & 2 deletions joint_limits/test/joint_limits_rosparam_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class JointLimitsRosParamTest : public ::testing::Test
rclcpp::NodeOptions node_options;
node_options.allow_undeclared_parameters(true).automatically_declare_parameters_from_overrides(
true);
const std::vector<std::string> node_option_arguments = {
"--ros-args", "--params-file",
std::string(PARAMETERS_FILE_PATH) + std::string("joint_limits_rosparam.yaml")};
node_options.arguments(node_option_arguments);

node_ = rclcpp::Node::make_shared("JointLimitsRosparamTestNode", node_options);
}
Expand Down Expand Up @@ -279,7 +283,16 @@ TEST_F(JointLimitsRosParamTest, parse_soft_joint_limits)
class JointLimitsUndeclaredRosParamTest : public ::testing::Test
{
public:
void SetUp() { node_ = rclcpp::Node::make_shared("JointLimitsRosparamTestNode"); }
void SetUp()
{
rclcpp::NodeOptions node_options;
const std::vector<std::string> node_option_arguments = {
"--ros-args", "--params-file",
std::string(PARAMETERS_FILE_PATH) + std::string("joint_limits_rosparam.yaml")};
node_options.arguments(node_option_arguments);

node_ = rclcpp::Node::make_shared("JointLimitsRosparamTestNode", node_options);
}

void TearDown() { node_.reset(); }

Expand All @@ -292,7 +305,14 @@ class JointLimitsLifecycleNodeUndeclaredRosParamTest : public ::testing::Test
public:
void SetUp()
{
lifecycle_node_ = rclcpp_lifecycle::LifecycleNode::make_shared("JointLimitsRosparamTestNode");
rclcpp::NodeOptions node_options;
const std::vector<std::string> node_option_arguments = {
"--ros-args", "--params-file",
std::string(PARAMETERS_FILE_PATH) + std::string("joint_limits_rosparam.yaml")};
node_options.arguments(node_option_arguments);

lifecycle_node_ =
rclcpp_lifecycle::LifecycleNode::make_shared("JointLimitsRosparamTestNode", node_options);
}

void TearDown()
Expand Down
Loading