fix leak in test_expand_topic_name (#444)
Signed-off-by: Abby Xu <abbyxu@amazon.com>
This commit is contained in:
parent
c972d0300e
commit
82f93afde5
1 changed files with 19 additions and 0 deletions
|
@ -44,7 +44,11 @@ TEST(test_expand_topic_name, normal) {
|
||||||
ret = rcl_expand_topic_name(topic, node, ns, &subs, allocator, &expanded_topic);
|
ret = rcl_expand_topic_name(topic, node, ns, &subs, allocator, &expanded_topic);
|
||||||
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
|
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
|
||||||
EXPECT_STREQ(expected.c_str(), expanded_topic);
|
EXPECT_STREQ(expected.c_str(), expanded_topic);
|
||||||
|
allocator.deallocate(expanded_topic, allocator.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = rcutils_string_map_fini(&subs);
|
||||||
|
ASSERT_EQ(RCL_RET_OK, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_expand_topic_name, invalid_arguments) {
|
TEST(test_expand_topic_name, invalid_arguments) {
|
||||||
|
@ -116,6 +120,9 @@ TEST(test_expand_topic_name, invalid_arguments) {
|
||||||
EXPECT_EQ(RCL_RET_NODE_INVALID_NAMESPACE, ret);
|
EXPECT_EQ(RCL_RET_NODE_INVALID_NAMESPACE, ret);
|
||||||
rcl_reset_error();
|
rcl_reset_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = rcutils_string_map_fini(&subs);
|
||||||
|
ASSERT_EQ(RCL_RET_OK, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_expand_topic_name, various_valid_topics) {
|
TEST(test_expand_topic_name, various_valid_topics) {
|
||||||
|
@ -174,7 +181,11 @@ TEST(test_expand_topic_name, various_valid_topics) {
|
||||||
ss.str() <<
|
ss.str() <<
|
||||||
", it failed with '" << ret << "': " << rcl_get_error_string().str;
|
", it failed with '" << ret << "': " << rcl_get_error_string().str;
|
||||||
EXPECT_STREQ(expected.c_str(), expanded_topic) << ss.str() << " strings did not match.\n";
|
EXPECT_STREQ(expected.c_str(), expanded_topic) << ss.str() << " strings did not match.\n";
|
||||||
|
allocator.deallocate(expanded_topic, allocator.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = rcutils_string_map_fini(&subs);
|
||||||
|
ASSERT_EQ(RCL_RET_OK, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_expand_topic_name, unknown_substitution) {
|
TEST(test_expand_topic_name, unknown_substitution) {
|
||||||
|
@ -195,7 +206,11 @@ TEST(test_expand_topic_name, unknown_substitution) {
|
||||||
EXPECT_EQ(RCL_RET_UNKNOWN_SUBSTITUTION, ret);
|
EXPECT_EQ(RCL_RET_UNKNOWN_SUBSTITUTION, ret);
|
||||||
rcl_reset_error();
|
rcl_reset_error();
|
||||||
EXPECT_EQ(NULL, expanded_topic);
|
EXPECT_EQ(NULL, expanded_topic);
|
||||||
|
allocator.deallocate(expanded_topic, allocator.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = rcutils_string_map_fini(&subs);
|
||||||
|
ASSERT_EQ(RCL_RET_OK, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_expand_topic_name, custom_substitution) {
|
TEST(test_expand_topic_name, custom_substitution) {
|
||||||
|
@ -218,5 +233,9 @@ TEST(test_expand_topic_name, custom_substitution) {
|
||||||
ret = rcl_expand_topic_name(topic, node, ns, &subs, allocator, &expanded_topic);
|
ret = rcl_expand_topic_name(topic, node, ns, &subs, allocator, &expanded_topic);
|
||||||
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
|
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
|
||||||
EXPECT_STREQ("/my_ns/pong", expanded_topic);
|
EXPECT_STREQ("/my_ns/pong", expanded_topic);
|
||||||
|
allocator.deallocate(expanded_topic, allocator.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = rcutils_string_map_fini(&subs);
|
||||||
|
ASSERT_EQ(RCL_RET_OK, ret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue