diff --git a/rmw/include/rmw/rmw.h b/rmw/include/rmw/rmw.h
index dbcafd87..b0e74b69 100644
--- a/rmw/include/rmw/rmw.h
+++ b/rmw/include/rmw/rmw.h
@@ -894,12 +894,12 @@ rmw_count_subscribers(
size_t * count);
/**
- * Retrieves a list of all publishers (described by the rmw_participants_t struct)
- * publishing to a specific topic along with its respective qos profile.
+ * Retrieves a list of all publishers publishing to a specific topic along with its respective qos profile.
*
- * None of the parameters provided to this function can be NULL.
+ * The node parameter must not be `NULL` and must point to a valid node.
*
- * Incorrect or non existent topic names are allowed.
+ * The topic_name parameter must not be `NULL`.
+ * Incorrect or non existent topic names are allowed. They will return an empty array.
*
* \param[in] node the handle to the node being used to query the ROS graph.
* \param[in] topic_name the name of the topic for which the list of publishers will be retrieved.
@@ -920,9 +920,10 @@ rmw_get_qos_for_publishers(
* Retrieves a list of all subscribers (described by the rmw_participants_t struct)
* subscribing to a specific topic along with its respective qos profile.
*
- * None of the parameters provided to this function can be NULL.
+ * The node parameter must not be `NULL` and must point to a valid node.
*
- * Incorrect or non existent topic names are allowed.
+ * The topic_name parameter must not be `NULL`.
+ * Incorrect or non existent topic names are allowed. They will return an empty array.
*
* \param[in] node the handle to the node being used to query the ROS graph.
* \param[in] topic_name the name of the topic for which the list of subscribers will be retrieved.
diff --git a/rmw/package.xml b/rmw/package.xml
index c94084c0..757262c8 100644
--- a/rmw/package.xml
+++ b/rmw/package.xml
@@ -19,7 +19,7 @@
ament_cmake_gmock
ament_lint_auto
ament_lint_common
-
+ osrf_testing_tools_cpp
ament_cmake
diff --git a/rmw/test/CMakeLists.txt b/rmw/test/CMakeLists.txt
index 95645a71..fb7a54ba 100644
--- a/rmw/test/CMakeLists.txt
+++ b/rmw/test/CMakeLists.txt
@@ -1,4 +1,5 @@
find_package(ament_cmake_gmock REQUIRED)
+find_package(osrf_testing_tools_cpp REQUIRED)
ament_add_gmock(test_serialized_message
test_serialized_message.cpp
@@ -48,5 +49,6 @@ ament_add_gmock(test_rmw_participant_qos_profile_allocator
APPEND_LIBRARY_DIRS "$"
)
if(TARGET test_rmw_participant_qos_profile_allocator)
- target_link_libraries(test_rmw_participant_qos_profile_allocator ${PROJECT_NAME})
+ target_link_libraries(test_rmw_participant_qos_profile_allocator ${PROJECT_NAME}
+ osrf_testing_tools_cpp::memory_tools)
endif()
diff --git a/rmw/test/test_rmw_participant_qos_profile_allocator.cpp b/rmw/test/test_rmw_participant_qos_profile_allocator.cpp
index 67bf5ae0..8c35b232 100644
--- a/rmw/test/test_rmw_participant_qos_profile_allocator.cpp
+++ b/rmw/test/test_rmw_participant_qos_profile_allocator.cpp
@@ -1,4 +1,4 @@
-// Copyright 2018 Open Source Robotics Foundation, Inc.
+// Copyright 2019 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,25 +14,35 @@
#include "gtest/gtest.h"
+#include "osrf_testing_tools_cpp/scope_exit.hpp"
#include "rmw/allocators.h"
#include "rmw/types.h"
TEST(test_rmw_participant_qos_profile_allocator, test_allocate_does_not_return_null) {
rmw_participant_qos_profile_t * qos_profile = rmw_participant_qos_profile_allocate();
- ASSERT_TRUE(qos_profile != NULL);
+ OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
+ delete (qos_profile);
+ });
+ EXPECT_NE(qos_profile, nullptr);
}
TEST(test_rmw_participant_qos_profile_allocator, test_allocate_allocates_different_pointers) {
rmw_participant_qos_profile_t * qos_profile1 = rmw_participant_qos_profile_allocate();
rmw_participant_qos_profile_t * qos_profile2 = rmw_participant_qos_profile_allocate();
- ASSERT_TRUE(qos_profile1 != qos_profile2);
+ OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
+ delete (qos_profile1);
+ delete (qos_profile2);
+ });
+ EXPECT_NE(qos_profile1, qos_profile2);
}
TEST(test_rmw_participant_qos_profile_allocator, test_free_null) {
- EXPECT_NO_THROW(rmw_participant_qos_profile_free(NULL));
+ rmw_participant_qos_profile_free(NULL);
+ SUCCEED();
}
TEST(test_rmw_participant_qos_profile_allocator, test_free_allocated) {
rmw_participant_qos_profile_t * qos_profile = rmw_participant_qos_profile_allocate();
- EXPECT_NO_THROW(rmw_participant_qos_profile_free(qos_profile));
+ rmw_participant_qos_profile_free(qos_profile);
+ SUCCEED();
}