mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
39 lines
746 B
C++
39 lines
746 B
C++
#include <unit_test/unit_test.h>
|
|
|
|
#include <drivers/drv_hrt.h>
|
|
#include <geo/geo.h>
|
|
#include <px4iofirmware/px4io.h>
|
|
#include <systemlib/err.h>
|
|
#include <systemlib/mixer/mixer.h>
|
|
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
class AutoDeclinationTest : public UnitTest
|
|
{
|
|
public:
|
|
virtual bool run_tests();
|
|
|
|
private:
|
|
bool autodeclination_check();
|
|
};
|
|
|
|
bool AutoDeclinationTest::autodeclination_check()
|
|
{
|
|
ut_assert("declination differs more than 1 degree", get_mag_declination(47.0, 8.0) - 0.6f < 0.5f);
|
|
|
|
return true;
|
|
}
|
|
|
|
bool AutoDeclinationTest::run_tests()
|
|
{
|
|
ut_run_test(autodeclination_check);
|
|
|
|
return (_tests_failed == 0);
|
|
}
|
|
|
|
ut_declare_test_c(test_autodeclination, AutoDeclinationTest)
|