Skip to content

Commit

Permalink
Make public ini/fini rosout publisher (#704)
Browse files Browse the repository at this point in the history
* Add bad param tests ini/fini rosout publisher
* Make ini/fini_publisher_for_node public

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
  • Loading branch information
Blast545 authored Jul 20, 2020
1 parent 1a7f737 commit c499108
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rcl/include/rcl/logging_rosout.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ rcl_logging_rosout_fini();
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed, or
* \return `RCL_RET_ERROR` if an unspecified error occurs.
*/
RCL_LOCAL
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_logging_rosout_init_publisher_for_node(
Expand All @@ -124,7 +124,7 @@ rcl_logging_rosout_init_publisher_for_node(
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed, or
* \return `RCL_RET_ERROR` if an unspecified error occurs.
*/
RCL_LOCAL
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_logging_rosout_fini_publisher_for_node(
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 @@ -290,3 +290,27 @@ TEST_F(

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 c499108

Please sign in to comment.