Skip to content

Commit

Permalink
Fix tests of the PID exported state interfaces controller
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Feb 5, 2025
1 parent 091b68c commit a1f1793
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions pid_controller/test/test_pid_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ TEST_F(PidControllerTest, check_exported_interfaces)
++ri_index;
}
}

// check exported state interfaces
auto state_ifs = controller_->export_state_interfaces();
ASSERT_EQ(state_ifs.size(), dof_state_values_.size());
size_t s_index = 0;
for (const auto & interface : state_interfaces_)
{
for (const auto & dof_name : dof_names_)
{
const std::string state_itf_name =
std::string(controller_->get_node()->get_name()) + "/" + dof_name + "/" + interface;
EXPECT_EQ(state_ifs[s_index]->get_name(), state_itf_name);
EXPECT_EQ(
state_ifs[s_index]->get_prefix_name(),
std::string(controller_->get_node()->get_name()) + "/" + dof_name);
EXPECT_EQ(state_ifs[s_index]->get_interface_name(), interface);
++s_index;
}
}
}

TEST_F(PidControllerTest, activate_success)
Expand Down
5 changes: 3 additions & 2 deletions pid_controller/test/test_pid_controller_preceding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ TEST_F(PidControllerTest, check_exported_interfaces)
std::string(controller_->get_node()->get_name()) + "/" + dof_name + "/" + interface;
EXPECT_EQ(exported_state_itfs[esi_index]->get_name(), state_itf_name);
EXPECT_EQ(
exported_state_itfs[esi_index]->get_prefix_name(), controller_->get_node()->get_name());
EXPECT_EQ(exported_state_itfs[esi_index]->get_interface_name(), dof_name + "/" + interface);
exported_state_itfs[esi_index]->get_prefix_name(),
std::string(controller_->get_node()->get_name()) + "/" + dof_name);
EXPECT_EQ(exported_state_itfs[esi_index]->get_interface_name(), interface);
++esi_index;
}
}
Expand Down

0 comments on commit a1f1793

Please sign in to comment.