Skip to content

Commit

Permalink
Add test creating two content filter topics with the same topic name (#…
Browse files Browse the repository at this point in the history
…2546) (#2549)

Signed-off-by: Mario-DL <mariodominguez@eprosima.com>
Co-authored-by: Mario Domínguez López <116071334+Mario-DL@users.noreply.github.com>
  • Loading branch information
ahcorde and Mario-DL authored Jun 4, 2024
1 parent d8d83a0 commit 7c09688
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions rclcpp/test/rclcpp/test_subscription_content_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,25 @@ TEST_F(CLASSNAME(TestContentFilterSubscription, RMW_IMPLEMENTATION), content_fil
}
}
}

TEST_F(
CLASSNAME(
TestContentFilterSubscription,
RMW_IMPLEMENTATION), create_two_content_filters_with_same_topic_name_and_destroy) {

// Create another content filter
auto options = rclcpp::SubscriptionOptions();

std::string filter_expression = "int32_value > %0";
std::vector<std::string> expression_parameters = {"4"};

options.content_filter_options.filter_expression = filter_expression;
options.content_filter_options.expression_parameters = expression_parameters;

auto callback = [](std::shared_ptr<const test_msgs::msg::BasicTypes>) {};
auto sub_2 = node->create_subscription<test_msgs::msg::BasicTypes>(
"content_filter_topic", qos, callback, options);

EXPECT_NE(nullptr, sub_2);
sub_2.reset();
}

0 comments on commit 7c09688

Please sign in to comment.