rename RCL_LIFECYCLE_RET_T to lifecycle_msgs::msgs::Transition::TRANSITION_CALLBACK_* (#345)

This commit is contained in:
Karsten Knese 2017-08-02 14:04:34 -07:00 committed by GitHub
parent a41245e6bf
commit 9281e32f82
8 changed files with 156 additions and 116 deletions

View file

@ -46,16 +46,18 @@ public:
size_t number_of_callbacks = 0;
protected:
rcl_lifecycle_ret_t on_configure(const rclcpp_lifecycle::State &)
rcl_lifecycle_transition_key_t
on_configure(const rclcpp_lifecycle::State &)
{
++number_of_callbacks;
throw std::runtime_error("custom exception raised in configure callback");
}
rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State &)
rcl_lifecycle_transition_key_t
on_error(const rclcpp_lifecycle::State &)
{
++number_of_callbacks;
return RCL_LIFECYCLE_RET_OK;
return lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_SUCCESS;
}
};
@ -73,9 +75,9 @@ TEST_F(TestCallbackExceptions, positive_on_error_with_code) {
auto test_node = std::make_shared<PositiveCallbackExceptionNode>("testnode");
EXPECT_EQ(State::PRIMARY_STATE_UNCONFIGURED, test_node->get_current_state().id());
rcl_lifecycle_ret_t ret = RCL_LIFECYCLE_RET_OK;
rcl_lifecycle_transition_key_t ret = lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_SUCCESS;
test_node->configure(ret);
EXPECT_EQ(RCL_LIFECYCLE_RET_ERROR, ret);
EXPECT_EQ(lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_ERROR, ret);
}
class NegativeCallbackExceptionNode : public rclcpp_lifecycle::LifecycleNode
@ -88,16 +90,18 @@ public:
size_t number_of_callbacks = 0;
protected:
rcl_lifecycle_ret_t on_configure(const rclcpp_lifecycle::State &)
rcl_lifecycle_transition_key_t
on_configure(const rclcpp_lifecycle::State &)
{
++number_of_callbacks;
throw std::runtime_error("custom exception raised in configure callback");
}
rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State &)
rcl_lifecycle_transition_key_t
on_error(const rclcpp_lifecycle::State &)
{
++number_of_callbacks;
return RCL_LIFECYCLE_RET_FAILURE;
return lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_FAILURE;
}
};
@ -115,7 +119,7 @@ TEST_F(TestCallbackExceptions, negative_on_error_with_code) {
auto test_node = std::make_shared<NegativeCallbackExceptionNode>("testnode");
EXPECT_EQ(State::PRIMARY_STATE_UNCONFIGURED, test_node->get_current_state().id());
rcl_lifecycle_ret_t ret = RCL_RET_OK;
rcl_lifecycle_transition_key_t ret = RCL_RET_OK;
test_node->configure(ret);
EXPECT_EQ(RCL_LIFECYCLE_RET_ERROR, ret);
EXPECT_EQ(lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_ERROR, ret);
}