* 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:
Karsten Knese 2017-12-05 22:51:52 -08:00 committed by GitHub
parent c40f3c25c6
commit 6d13bcb0fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 286 additions and 6 deletions

View file

@ -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());
}