From 04d859e36ecde79d4b9e02235a9ed5eaf22571b9 Mon Sep 17 00:00:00 2001 From: Julian Kent Date: Wed, 16 Dec 2020 13:48:11 +0100 Subject: [PATCH] Fix test failure from parameter autosave starting WQ --- .../GeofenceBreachAvoidanceTest.cpp | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/modules/navigator/GeofenceBreachAvoidance/GeofenceBreachAvoidanceTest.cpp b/src/modules/navigator/GeofenceBreachAvoidance/GeofenceBreachAvoidanceTest.cpp index 402e6ede3b..896ab1f00d 100644 --- a/src/modules/navigator/GeofenceBreachAvoidance/GeofenceBreachAvoidanceTest.cpp +++ b/src/modules/navigator/GeofenceBreachAvoidance/GeofenceBreachAvoidanceTest.cpp @@ -34,11 +34,21 @@ #include #include "geofence_breach_avoidance.h" #include "fake_geofence.hpp" +#include using namespace matrix; using Vector2d = matrix::Vector2; -TEST(GeofenceBreachAvoidanceTest, waypointFromBearingAndDistance) +class GeofenceBreachAvoidanceTest : public ::testing::Test +{ +public: + void SetUp() override + { + param_control_autosave(false); + } +}; + +TEST_F(GeofenceBreachAvoidanceTest, waypointFromBearingAndDistance) { GeofenceBreachAvoidance gf_avoidance; @@ -74,7 +84,7 @@ TEST(GeofenceBreachAvoidanceTest, waypointFromBearingAndDistance) EXPECT_EQ(home_global, same_as_home_global); } -TEST(GeofenceBreachAvoidanceTest, generateLoiterPointForFixedWing) +TEST_F(GeofenceBreachAvoidanceTest, generateLoiterPointForFixedWing) { GeofenceBreachAvoidance gf_avoidance; FakeGeofence geo; @@ -122,7 +132,7 @@ TEST(GeofenceBreachAvoidanceTest, generateLoiterPointForFixedWing) EXPECT_FLOAT_EQ(loiter_point_lat_lon(1), home_global(1)); } -TEST(GeofenceBreachAvoidanceTest, generateLoiterPointForMultirotor) +TEST_F(GeofenceBreachAvoidanceTest, generateLoiterPointForMultirotor) { GeofenceBreachAvoidance gf_avoidance; FakeGeofence geo; @@ -185,7 +195,7 @@ TEST(GeofenceBreachAvoidanceTest, generateLoiterPointForMultirotor) EXPECT_EQ(loiter_point, home_global); } -TEST(GeofenceBreachAvoidanceTest, generateLoiterAltitudeForFixedWing) +TEST_F(GeofenceBreachAvoidanceTest, generateLoiterAltitudeForFixedWing) { GeofenceBreachAvoidance gf_avoidance; const float current_alt_amsl = 100.0f; @@ -207,7 +217,7 @@ TEST(GeofenceBreachAvoidanceTest, generateLoiterAltitudeForFixedWing) EXPECT_EQ(loiter_alt, current_alt_amsl); } -TEST(GeofenceBreachAvoidanceTest, generateLoiterAltitudeForMulticopter) +TEST_F(GeofenceBreachAvoidanceTest, generateLoiterAltitudeForMulticopter) { GeofenceBreachAvoidance gf_avoidance; const float climbrate = 10.0f; @@ -231,7 +241,7 @@ TEST(GeofenceBreachAvoidanceTest, generateLoiterAltitudeForMulticopter) EXPECT_EQ(loiter_alt_amsl, current_alt_amsl); } -TEST(GeofenceBreachAvoidance, maxDistToHomeViolationMulticopter) +TEST_F(GeofenceBreachAvoidanceTest, maxDistToHomeViolationMulticopter) { GeofenceBreachAvoidance gf_avoidance; FakeGeofence geo; @@ -264,7 +274,7 @@ TEST(GeofenceBreachAvoidance, maxDistToHomeViolationMulticopter) EXPECT_EQ(loiter_point_predicted, loiter_point_lat_lon); } -TEST(GeofenceBreachAvoidance, maxDistToHomeViolationFixedWing) +TEST_F(GeofenceBreachAvoidanceTest, maxDistToHomeViolationFixedWing) { GeofenceBreachAvoidance gf_avoidance; FakeGeofence geo;