From aa4bbdfce1d1d1ea4292ff3bf53cbf90d032d8a4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 9 Jul 2021 19:13:24 +1000 Subject: [PATCH] AP_Math: added test for SCurve::calculate_path this was the values shown in the core dump for failing guided mode test in CI --- libraries/AP_Math/tests/test_scurve.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 libraries/AP_Math/tests/test_scurve.cpp diff --git a/libraries/AP_Math/tests/test_scurve.cpp b/libraries/AP_Math/tests/test_scurve.cpp new file mode 100644 index 0000000000..6620d790a0 --- /dev/null +++ b/libraries/AP_Math/tests/test_scurve.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include +#include +#include + +TEST(LinesScurve, test_calculate_path) +{ + float Jm_out, t2_out, t4_out, t6_out; + SCurve::calculate_path(0.300000012, 19.4233513, 0, 5.82700586, 188.354691, 2.09772229, + Jm_out, t2_out, t4_out, t6_out); + EXPECT_FLOAT_EQ(Jm_out, 19.423351); + EXPECT_FLOAT_EQ(t2_out, 0.0); + EXPECT_FLOAT_EQ(t4_out, 0.0); + EXPECT_FLOAT_EQ(t6_out, 0.0); +} + + +AP_GTEST_MAIN() +int hal = 0; //weirdly the build will fail without this