mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-05 13:20:35 +08:00
Add unit testing possibility using googletest on POSIX
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <AttitudeControl.hpp>
|
||||
|
||||
using namespace matrix;
|
||||
|
||||
TEST(AttitudeControlTest, AllZeroCase) {
|
||||
AttitudeControl attitude_control;
|
||||
matrix::Vector3f rate_setpoint = attitude_control.update(Quatf(), Quatf(), 0.f);
|
||||
EXPECT_EQ(rate_setpoint(0), 0.f);
|
||||
EXPECT_EQ(rate_setpoint(1), 0.f);
|
||||
EXPECT_EQ(rate_setpoint(2), 0.f);
|
||||
}
|
||||
@@ -38,3 +38,5 @@ target_include_directories(AttitudeControl
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
px4_add_gtest(SRC AttitudeControlTest.cpp LINKLIBS AttitudeControl)
|
||||
|
||||
Reference in New Issue
Block a user