Skip to content

Commit

Permalink
Add bad param tests ini/fini rosout publisher
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
  • Loading branch information
Blast545 committed Jul 15, 2020
1 parent 944068f commit e6a0279
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rcl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function(test_target_function)
)

rcl_add_custom_gtest(test_logging_rosout${target_suffix}
SRCS rcl/test_logging_rosout.cpp
SRCS rcl/test_logging_rosout.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../src/rcl/logging_rosout.c
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
Expand Down
24 changes: 24 additions & 0 deletions rcl/test/rcl/test_logging_rosout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,30 @@ TEST_F(

// Init twice returns RCL_RET_OK
EXPECT_EQ(RCL_RET_OK, rcl_logging_rosout_init(&allocator));

EXPECT_EQ(RCL_RET_OK, rcl_logging_rosout_fini());
}

/* Bad params
*/
TEST_F(
CLASSNAME(
TestLogRosoutFixtureNotParam, RMW_IMPLEMENTATION),
test_bad_params_init_fini_node_publisher)
{
rcl_allocator_t allocator = rcl_get_default_allocator();
rcl_node_t not_init_node = rcl_get_zero_initialized_node();
EXPECT_EQ(RCL_RET_OK, rcl_logging_rosout_init(&allocator));

EXPECT_EQ(RCL_RET_NODE_INVALID, rcl_logging_rosout_init_publisher_for_node(nullptr));
rcl_reset_error();
EXPECT_EQ(RCL_RET_ERROR, rcl_logging_rosout_init_publisher_for_node(&not_init_node));
rcl_reset_error();

EXPECT_EQ(RCL_RET_NODE_INVALID, rcl_logging_rosout_fini_publisher_for_node(nullptr));
rcl_reset_error();
EXPECT_EQ(RCL_RET_ERROR, rcl_logging_rosout_fini_publisher_for_node(&not_init_node));
rcl_reset_error();

EXPECT_EQ(RCL_RET_OK, rcl_logging_rosout_fini());
}

0 comments on commit e6a0279

Please sign in to comment.