Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a test case for cft options not supported #217

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions test_rmw_implementation/test/test_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,40 @@ TEST_F(CLASSNAME(TestSubscription, RMW_IMPLEMENTATION), create_with_bad_argument
EXPECT_EQ(RMW_RET_OK, ret) << rmw_get_error_string().str;
}

TEST_F(CLASSNAME(TestSubscription, RMW_IMPLEMENTATION), create_with_unsupported_cft_options) {
constexpr char topic_name[] = "/test";
const rosidl_message_type_support_t * ts =
ROSIDL_GET_MSG_TYPE_SUPPORT(test_msgs, msg, BasicTypes);

rmw_subscription_options_t options = rmw_get_default_subscription_options();
auto allocator = rcutils_get_default_allocator();

rmw_subscription_content_filter_options_t content_filter_options =
rmw_get_zero_initialized_content_filter_options();

EXPECT_EQ(
RMW_RET_OK, rmw_subscription_content_filter_options_init(
"float32_value=not_exist_float_max()",
0,
NULL,
&allocator,
&content_filter_options));
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
{
EXPECT_EQ(
RMW_RET_OK,
rmw_subscription_content_filter_options_fini(&content_filter_options, &allocator));
});
options.content_filter_options = &content_filter_options;

rmw_subscription_t * sub =
rmw_create_subscription(node, ts, topic_name, &rmw_qos_profile_default, &options);
ASSERT_NE(nullptr, sub) << rmw_get_error_string().str;
EXPECT_FALSE(sub->is_cft_enabled);
rmw_ret_t ret = rmw_destroy_subscription(node, sub);
EXPECT_EQ(RMW_RET_OK, ret) << rmw_get_error_string().str;
}

TEST_F(CLASSNAME(TestSubscription, RMW_IMPLEMENTATION), create_with_internal_errors) {
constexpr char topic_name[] = "/test";
const rosidl_message_type_support_t * ts =
Expand Down