From 70f48d68b9a8171c2033a5e08ed468ea84bb81a9 Mon Sep 17 00:00:00 2001 From: "M. M" Date: Mon, 15 Apr 2019 17:44:44 -0700 Subject: [PATCH] correct initialization of rmw_qos_profile_t struct instances (#691) Signed-off-by: Miaofei --- rclcpp/test/test_publisher.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rclcpp/test/test_publisher.cpp b/rclcpp/test/test_publisher.cpp index 572daff..e0815df 100644 --- a/rclcpp/test/test_publisher.cpp +++ b/rclcpp/test/test_publisher.cpp @@ -65,6 +65,14 @@ protected: rclcpp::Node::SharedPtr subnode; }; +static constexpr rmw_qos_profile_t invalid_qos_profile() +{ + rmw_qos_profile_t profile = rmw_qos_profile_default; + profile.depth = 1; + profile.durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; + return profile; +} + /* Testing publisher construction and destruction. */ @@ -87,13 +95,7 @@ TEST_F(TestPublisher, construction_and_destruction) { */ TEST_F(TestPublisher, intraprocess_with_invalid_qos) { initialize(rclcpp::NodeOptions().use_intra_process_comms(true)); - rmw_qos_profile_t qos = { - RMW_QOS_POLICY_HISTORY_KEEP_LAST, - 1, - RMW_QOS_POLICY_RELIABILITY_RELIABLE, - RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL, - false - }; + rmw_qos_profile_t qos = invalid_qos_profile(); using rcl_interfaces::msg::IntraProcessMessage; { ASSERT_THROW(