From 618724b40960c8ba33a76ea3e858adf85033e539 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Tue, 9 May 2023 15:38:11 +0200 Subject: [PATCH] Functional gtests: remove unnecessary subscription updates A new subscription is updated on instanciation and no additional update needs to be called for processing the first sample. --- src/lib/avoidance/ObstacleAvoidanceTest.cpp | 1 - src/modules/rc_update/RCUpdateTest.cpp | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/src/lib/avoidance/ObstacleAvoidanceTest.cpp b/src/lib/avoidance/ObstacleAvoidanceTest.cpp index 593bbabbd7..008a8758a9 100644 --- a/src/lib/avoidance/ObstacleAvoidanceTest.cpp +++ b/src/lib/avoidance/ObstacleAvoidanceTest.cpp @@ -198,7 +198,6 @@ TEST_F(ObstacleAvoidanceTest, oa_desired) // WHEN: we subscribe to the uORB message out of the interface uORB::SubscriptionData _sub_traj_wp_avoidance_desired{ORB_ID(vehicle_trajectory_waypoint_desired)}; - _sub_traj_wp_avoidance_desired.update(); // THEN: we expect the setpoints in POINT_0 and waypoints in POINT_1 and POINT_2 EXPECT_FLOAT_EQ(pos_sp(0), diff --git a/src/modules/rc_update/RCUpdateTest.cpp b/src/modules/rc_update/RCUpdateTest.cpp index 71035480c5..d0df1c28be 100644 --- a/src/modules/rc_update/RCUpdateTest.cpp +++ b/src/modules/rc_update/RCUpdateTest.cpp @@ -71,8 +71,6 @@ public: // THEN: we receive the expected mode slot uORB::SubscriptionData manual_control_switches_sub{ORB_ID(manual_control_switches)}; - manual_control_switches_sub.update(); - EXPECT_EQ(manual_control_switches_sub.get().mode_slot, expected_slot); } @@ -102,8 +100,6 @@ public: // THEN: we receive the expected mode slot uORB::SubscriptionData manual_control_switches_sub{ORB_ID(manual_control_switches)}; - manual_control_switches_sub.update(); - EXPECT_EQ(manual_control_switches_sub.get().mode_slot, expected_slot); // Reset channel value for the next test @@ -129,8 +125,6 @@ public: // THEN: we receive the expected mode slot uORB::SubscriptionData manual_control_switches_sub{ORB_ID(manual_control_switches)}; - manual_control_switches_sub.update(); - EXPECT_EQ(manual_control_switches_sub.get().return_switch, expected_position); } @@ -155,8 +149,6 @@ TEST_F(RCUpdateTest, ModeSlotUnassigned) // THEN: we receive no mode slot uORB::SubscriptionData manual_control_switches_sub{ORB_ID(manual_control_switches)}; - manual_control_switches_sub.update(); - EXPECT_EQ(manual_control_switches_sub.get().mode_slot, 0); // manual_control_switches_s::MODE_SLOT_NONE } @@ -198,8 +190,6 @@ TEST_F(RCUpdateTest, ReturnSwitchUnassigned) // THEN: we receive an unmapped return switch state uORB::SubscriptionData manual_control_switches_sub{ORB_ID(manual_control_switches)}; - manual_control_switches_sub.update(); - EXPECT_EQ(manual_control_switches_sub.get().return_switch, 0); // manual_control_switches_s::SWITCH_POS_NONE }