Add unit testing possibility using googletest on POSIX

This commit is contained in:
Matthias Grob
2019-03-02 18:18:00 +01:00
parent 816aa0ffb6
commit 63b967f5df
8 changed files with 164 additions and 2 deletions
@@ -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)