correct initialization of rmw_qos_profile_t struct instances (#691)

Signed-off-by: Miaofei <miaofei@amazon.com>
This commit is contained in:
M. M 2019-04-15 17:44:44 -07:00 committed by William Woodall
parent fcfe94e404
commit 70f48d68b9

View file

@ -65,6 +65,14 @@ protected:
rclcpp::Node::SharedPtr subnode; 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. Testing publisher construction and destruction.
*/ */
@ -87,13 +95,7 @@ TEST_F(TestPublisher, construction_and_destruction) {
*/ */
TEST_F(TestPublisher, intraprocess_with_invalid_qos) { TEST_F(TestPublisher, intraprocess_with_invalid_qos) {
initialize(rclcpp::NodeOptions().use_intra_process_comms(true)); initialize(rclcpp::NodeOptions().use_intra_process_comms(true));
rmw_qos_profile_t qos = { rmw_qos_profile_t qos = invalid_qos_profile();
RMW_QOS_POLICY_HISTORY_KEEP_LAST,
1,
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
false
};
using rcl_interfaces::msg::IntraProcessMessage; using rcl_interfaces::msg::IntraProcessMessage;
{ {
ASSERT_THROW( ASSERT_THROW(