Skip to content

Commit

Permalink
controller_manager_srvs tests: Add text to assertions (backport ros-c…
Browse files Browse the repository at this point in the history
…ontrols#1023) (ros-controls#1029)

* Add text to assertions references (ros-controls#1023)

This should make debugging failed tests easier.

(cherry picked from commit 775dd6a)

# Conflicts:
#	controller_manager/test/test_hardware_management_srvs.cpp

* plugin_name -> class_type

* plugin_name -> class_type

---------

Co-authored-by: Felix Exner (fexner) <[email protected]>
Co-authored-by: Bence Magyar <[email protected]>
  • Loading branch information
3 people authored and flochre committed Jul 5, 2023
1 parent 11fabc5 commit 3a791fe
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions controller_manager/test/test_hardware_management_srvs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,17 @@ class TestControllerManagerHWManagementSrvs : public TestControllerManagerSrvs
const std::string & name, const std::string & type, const std::string & class_type,
const uint8_t state_id, const std::string & state_label)
{
EXPECT_EQ(component.name, name);
EXPECT_EQ(component.type, type);
EXPECT_EQ(component.class_type, class_type);
EXPECT_EQ(component.state.id, state_id);
EXPECT_EQ(component.state.label, state_label);
EXPECT_EQ(component.name, name) << "Component has unexpected name.";
EXPECT_EQ(component.type, type)
<< "Component " << name << " from plugin " << class_type << " has wrong type.";
EXPECT_EQ(component.class_type, class_type)
<< "Component " << name << " (" << type << ") has unexpected class_type.";
EXPECT_EQ(component.state.id, state_id)
<< "Component " << name << " (" << type << ") from plugin " << class_type
<< " has wrong state_id.";
EXPECT_EQ(component.state.label, state_label)
<< "Component " << name << " (" << type << ") from plugin " << class_type
<< " has wrong state_label.";
}

void list_hardware_components_and_check(
Expand Down Expand Up @@ -124,8 +130,9 @@ class TestControllerManagerHWManagementSrvs : public TestControllerManagerSrvs
{
auto it = std::find(interface_names.begin(), interface_names.end(), interfaces[i].name);
EXPECT_NE(it, interface_names.end());
EXPECT_EQ(interfaces[i].is_available, is_available_status[i]);
EXPECT_EQ(interfaces[i].is_claimed, is_claimed_status[i]);
EXPECT_EQ(interfaces[i].is_available, is_available_status[i])
<< "At " << interfaces[i].name;
EXPECT_EQ(interfaces[i].is_claimed, is_claimed_status[i]) << "At " << interfaces[i].name;
}
};

Expand Down

0 comments on commit 3a791fe

Please sign in to comment.