Commit ddb4f877 authored by Don Gagne's avatar Don Gagne

Fixed UnitTest code and bugs found by unit tests

parent a389160c
...@@ -178,23 +178,23 @@ void UASUnitTest::getSystemType_test() ...@@ -178,23 +178,23 @@ void UASUnitTest::getSystemType_test()
void UASUnitTest::getAirframe_test() void UASUnitTest::getAirframe_test()
{ {
//when uas is constructed, airframe is set to QGC_AIRFRAME_GENERIC which is 0 //when uas is constructed, airframe is set to QGC_AIRFRAME_GENERIC
QCOMPARE(uas->getAirframe(), 0); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_GENERIC);
} }
void UASUnitTest::setAirframe_test() void UASUnitTest::setAirframe_test()
{ {
//check at construction, that airframe=0 (GENERIC) //check at construction, that airframe=0 (GENERIC)
QVERIFY(uas->getAirframe() == 0); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_GENERIC);
//check that set airframe works //check that set airframe works
uas->setAirframe(11); uas->setAirframe(UASInterface::QGC_AIRFRAME_HEXCOPTER);
QVERIFY(uas->getAirframe() == 11); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_HEXCOPTER);
//check that setAirframe will not assign a number to airframe, that is //check that setAirframe will not assign a number to airframe, that is
//not defined in the enum //not defined in the enum
uas->setAirframe(12); uas->setAirframe(UASInterface::QGC_AIRFRAME_END_OF_ENUM);
QVERIFY(uas->getAirframe() == 11); QVERIFY(uas->getAirframe() == UASInterface::QGC_AIRFRAME_HEXCOPTER);
} }
void UASUnitTest::getWaypointList_test() void UASUnitTest::getWaypointList_test()
...@@ -391,10 +391,10 @@ void UASUnitTest::signalIdUASLink_test() ...@@ -391,10 +391,10 @@ void UASUnitTest::signalIdUASLink_test()
LinkInterface* b = static_cast<LinkInterface*>(links.at(1)); LinkInterface* b = static_cast<LinkInterface*>(links.at(1));
LinkInterface* c = static_cast<LinkInterface*>(links.at(2)); LinkInterface* c = static_cast<LinkInterface*>(links.at(2));
LinkInterface* d = static_cast<LinkInterface*>(links.at(3)); LinkInterface* d = static_cast<LinkInterface*>(links.at(3));
QCOMPARE(a->getName(), QString("serial port COM 17")); QCOMPARE(a->getName(), QString("COM 17"));
QCOMPARE(b->getName(), QString("serial port COM 18")); QCOMPARE(b->getName(), QString("COM 18"));
QCOMPARE(c->getName(), QString("serial port COM 19")); QCOMPARE(c->getName(), QString("COM 19"));
QCOMPARE(d->getName(), QString("serial port COM 20")); QCOMPARE(d->getName(), QString("COM 20"));
LinkManager::instance()->removeLink(myLink4); LinkManager::instance()->removeLink(myLink4);
delete myLink4; delete myLink4;
......
...@@ -109,6 +109,11 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), ...@@ -109,6 +109,11 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
localX(0.0), localX(0.0),
localY(0.0), localY(0.0),
localZ(0.0), localZ(0.0),
latitude(0.0),
longitude(0.0),
altitude(0.0),
globalEstimatorActive(false), globalEstimatorActive(false),
latitude_gps(0.0), latitude_gps(0.0),
longitude_gps(0.0), longitude_gps(0.0),
...@@ -131,6 +136,10 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), ...@@ -131,6 +136,10 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
attitudeStamped(false), attitudeStamped(false),
lastAttitude(0), lastAttitude(0),
roll(0.0),
pitch(0.0),
yaw(0.0),
paramsOnceRequested(false), paramsOnceRequested(false),
simulation(0), simulation(0),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment