Make sure to check the return value of rcl APIs. (#838)

This is just a further check to ensure the test is correct,
and also gets rid of a slew of dead store warnings from
clang static analysis.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
This commit is contained in:
Chris Lalancette 2020-10-19 10:33:58 -04:00 committed by Alejandro Hernández Cordero
parent 0d353dde87
commit 885fa21a89
14 changed files with 50 additions and 3 deletions

View file

@ -69,6 +69,7 @@ TEST(TestRclLifecycle, lifecycle_state) {
rcutils_reset_error();
ret = rcl_lifecycle_state_init(&state, expected_id, &expected_label[0], &allocator);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
EXPECT_EQ(expected_id, state.id);
EXPECT_STREQ(&expected_label[0], state.label);

View file

@ -73,6 +73,7 @@ TEST_F(TestTransitionMap, initialized) {
rcl_lifecycle_state_t state1 = {"my_state_1", 1, NULL, 0};
ret = rcl_lifecycle_register_state(&transition_map, state1, &allocator);
ASSERT_EQ(RCL_RET_OK, ret);
rcl_lifecycle_state_t unregistered = {"my_state_2", 2, NULL, 0};
@ -96,7 +97,6 @@ TEST_F(TestTransitionMap, initialized) {
rcl_lifecycle_transition_t transition01 = {"from0to1", 0,
start_state, goal_state};
original_size = transition_map.transitions_size;
ret = rcl_lifecycle_register_transition(
&transition_map, transition01, &allocator);
EXPECT_EQ(RCL_RET_OK, ret);
@ -104,7 +104,6 @@ TEST_F(TestTransitionMap, initialized) {
rcl_lifecycle_transition_t transition10 = {"from1to0", 1,
goal_state, start_state};
original_size = transition_map.transitions_size;
ret = rcl_lifecycle_register_transition(
&transition_map, transition10, &allocator);
EXPECT_EQ(RCL_RET_OK, ret);