From 39a9d1d0d34dfcba38e52146a187146fb36050a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Wed, 30 Sep 2020 16:47:17 +0200 Subject: [PATCH] Covered resolve_use_intra_process (#1359) * Covered resolve_use_intra_process Signed-off-by: ahcorde * used RCLCPP_EXPECT_THROW_EQ in test_subscription_throws_intraprocess Signed-off-by: ahcorde --- rclcpp/test/rclcpp/test_subscription.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rclcpp/test/rclcpp/test_subscription.cpp b/rclcpp/test/rclcpp/test_subscription.cpp index ef626849a0..9559e69c4b 100644 --- a/rclcpp/test/rclcpp/test_subscription.cpp +++ b/rclcpp/test/rclcpp/test_subscription.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -461,6 +462,29 @@ TEST_P(TestSubscriptionInvalidIntraprocessQos, test_subscription_throws) { } } +/* + Testing subscription with invalid use_intra_process_comm + */ +TEST_P(TestSubscriptionInvalidIntraprocessQos, test_subscription_throws_intraprocess) { + rclcpp::SubscriptionOptionsWithAllocator> options; + options.use_intra_process_comm = static_cast(5); + + initialize(); + rclcpp::QoS qos = GetParam().qos; + auto callback = std::bind( + &TestSubscriptionInvalidIntraprocessQos::OnMessage, + this, + std::placeholders::_1); + + RCLCPP_EXPECT_THROW_EQ( + {auto subscription = node->create_subscription( + "topic", + qos, + callback, + options);}, + std::runtime_error("Unrecognized IntraProcessSetting value")); +} + static std::vector invalid_qos_profiles() { std::vector parameters;