From fc369c16e640367488266b71ccf3b1009aa69847 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sun, 11 May 2014 19:36:17 -0700 Subject: [PATCH] Fix UAS unit test for range and voltage change --- src/qgcunittest/UASUnitTest.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qgcunittest/UASUnitTest.cc b/src/qgcunittest/UASUnitTest.cc index b6c11b0f9..2fc948c24 100644 --- a/src/qgcunittest/UASUnitTest.cc +++ b/src/qgcunittest/UASUnitTest.cc @@ -73,15 +73,20 @@ void UASUnitTest::getCommunicationStatus_test() void UASUnitTest::filterVoltage_test() { float verificar=uas->filterVoltage(0.4f); - // Verify that upon construction the Comm status is disconnected - QCOMPARE(verificar, 8.52f); + + // We allow the voltage returned to be within a small delta + const float allowedDelta = 0.05f; + const float desiredVoltage = 7.36f; + QVERIFY(verificar > (desiredVoltage - allowedDelta) && verificar < (desiredVoltage + allowedDelta)); } + void UASUnitTest:: getAutopilotType_test() { int type = uas->getAutopilotType(); // Verify that upon construction the autopilot is set to -1 QCOMPARE(type, -1); } + void UASUnitTest::setAutopilotType_test() { uas->setAutopilotType(2); -- 2.22.0