Fix 394 (#419)
* copy and assignment operator for state copy and assignment operator for transition remove unused const_casts address comments check for null in copy constructor up use init and fini functions from rcl remove unused include * explicitly zero initialize state and transitions * add todo comment for follow up
This commit is contained in:
parent
c40f3c25c6
commit
6d13bcb0fc
6 changed files with 286 additions and 6 deletions
|
@ -63,3 +63,24 @@ TEST_F(TestTransitionWrapper, wrapper) {
|
|||
EXPECT_STREQ("from_start_to_goal", t.label().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TestTransitionWrapper, copy_constructor) {
|
||||
auto a = std::make_shared<rclcpp_lifecycle::Transition>(1, "my_transition");
|
||||
rclcpp_lifecycle::Transition b(*a);
|
||||
|
||||
a.reset();
|
||||
|
||||
EXPECT_EQ(1, b.id());
|
||||
EXPECT_STREQ("my_transition", b.label().c_str());
|
||||
}
|
||||
|
||||
TEST_F(TestTransitionWrapper, assignment_operator) {
|
||||
auto a = std::make_shared<rclcpp_lifecycle::Transition>(1, "one");
|
||||
auto b = std::make_shared<rclcpp_lifecycle::Transition>(2, "two");
|
||||
*b = *a;
|
||||
|
||||
a.reset();
|
||||
|
||||
EXPECT_EQ(1, b->id());
|
||||
EXPECT_STREQ("one", b->label().c_str());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue