Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
759715d5
Commit
759715d5
authored
Feb 11, 2011
by
Alejandro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on UASUnitTest
parent
dffc01d6
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1233 additions
and
1865 deletions
+1233
-1865
SlugsMavUnitTest.cc
qgcunittest/SlugsMavUnitTest.cc
+23
-20
SlugsMavUnitTest.h
qgcunittest/SlugsMavUnitTest.h
+32
-27
UASUnitTest.cc
qgcunittest/UASUnitTest.cc
+269
-156
UASUnitTest.h
qgcunittest/UASUnitTest.h
+64
-50
SlugsDataSensorView.ui
src/ui/SlugsDataSensorView.ui
+845
-1612
No files found.
qgcunittest/SlugsMavUnitTest.cc
View file @
759715d5
...
@@ -6,15 +6,18 @@ SlugsMavUnitTest::SlugsMavUnitTest()
...
@@ -6,15 +6,18 @@ SlugsMavUnitTest::SlugsMavUnitTest()
void
SlugsMavUnitTest
::
initTestCase
()
void
SlugsMavUnitTest
::
initTestCase
()
{
{
mav
=
new
MAVLinkProtocol
();
slugsMav
=
new
SlugsMAV
(
mav
,
UASID
);
}
}
void
SlugsMavUnitTest
::
cleanupTestCase
()
void
SlugsMavUnitTest
::
cleanupTestCase
()
{
{
delete
slugsMav
;
delete
mav
;
}
}
void
SlugsMavUnitTest
::
first_test
()
void
SlugsMavUnitTest
::
first_test
()
{
{
QCOMPARE
(
1
,
2
);
QCOMPARE
(
1
,
1
);
}
}
qgcunittest/SlugsMavUnitTest.h
View file @
759715d5
...
@@ -8,11 +8,15 @@
...
@@ -8,11 +8,15 @@
#include "MAVLinkProtocol.h"
#include "MAVLinkProtocol.h"
#include "UASInterface.h"
#include "UASInterface.h"
#include "AutoTest.h"
#include "AutoTest.h"
#include "SlugsMAV.h"
class
SlugsMavUnitTest
:
public
QObject
class
SlugsMavUnitTest
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
public:
public:
#define UASID 5
MAVLinkProtocol
*
mav
;
SlugsMAV
*
slugsMav
;
SlugsMavUnitTest
();
SlugsMavUnitTest
();
signals:
signals:
...
@@ -20,6 +24,7 @@ private slots:
...
@@ -20,6 +24,7 @@ private slots:
void
initTestCase
();
void
initTestCase
();
void
cleanupTestCase
();
void
cleanupTestCase
();
void
first_test
();
void
first_test
();
};
};
DECLARE_TEST
(
SlugsMavUnitTest
)
DECLARE_TEST
(
SlugsMavUnitTest
)
...
...
qgcunittest/UASUnitTest.cc
View file @
759715d5
...
@@ -30,6 +30,11 @@ void UASUnitTest::getUASID_test()
...
@@ -30,6 +30,11 @@ void UASUnitTest::getUASID_test()
// Make sure that no other ID was sert
// Make sure that no other ID was sert
QEXPECT_FAIL
(
""
,
"When you set an ID it does not use the default ID of 0"
,
Continue
);
QEXPECT_FAIL
(
""
,
"When you set an ID it does not use the default ID of 0"
,
Continue
);
QCOMPARE
(
uas
->
getUASID
(),
0
);
QCOMPARE
(
uas
->
getUASID
(),
0
);
// Make sure that ID >= 0
QCOMPARE
(
uas
->
getUASID
(),
-
1
);
}
}
void
UASUnitTest
::
getUASName_test
()
void
UASUnitTest
::
getUASName_test
()
...
@@ -154,3 +159,111 @@ void UASUnitTest::getYaw_test()
...
@@ -154,3 +159,111 @@ void UASUnitTest::getYaw_test()
{
{
QCOMPARE
(
uas
->
getYaw
(),
0.0
);
QCOMPARE
(
uas
->
getYaw
(),
0.0
);
}
}
void
UASUnitTest
::
getSelected_test
()
{
QCOMPARE
(
uas
->
getSelected
(),
false
);
//QCOMPARE(uas->getSelected(), true);
}
void
UASUnitTest
::
getSystemType_test
()
{
//QCOMPARE(uas->getSystemType(), -1);
QEXPECT_FAIL
(
""
,
"uas->getSystemType(), 0"
,
Continue
);
QCOMPARE
(
uas
->
getSystemType
(),
0
);
QEXPECT_FAIL
(
""
,
"uas->getSystemType(), 1"
,
Continue
);
QCOMPARE
(
uas
->
getSystemType
(),
1
);
int
systemType
=
uas
->
getSystemType
();
QCOMPARE
(
uas
->
getSystemType
(),
systemType
);
}
void
UASUnitTest
::
getAirframe_test
()
{
//QCOMPARE(uas->getAirframe(), -1);
QCOMPARE
(
uas
->
getAirframe
(),
0
);
uas
->
setAirframe
(
25
);
QCOMPARE
(
uas
->
getAirframe
(),
1
);
QVERIFY
(
uas
->
getAirframe
()
==
25
);
}
void
UASUnitTest
::
getLinks_test
()
{
// Compare that the links count equal to 0
QCOMPARE
(
uas
->
getLinks
()
->
count
(),
0
);
QList
<
LinkInterface
*>
links
=
LinkManager
::
instance
()
->
getLinks
();
// Compare that the links in LinkManager count equal to 0
QCOMPARE
(
links
.
count
(),
0
);
LinkInterface
*
l
;
uas
->
getLinks
()
->
append
(
l
);
// Compare that the links in LinkManager count equal to 1
QCOMPARE
(
uas
->
getLinks
()
->
count
(),
1
);
QList
<
LinkInterface
*>
links2
=
LinkManager
::
instance
()
->
getLinks
();
// Compare that the links count equals after update add link in uas
QCOMPARE
(
uas
->
getLinks
()
->
count
(),
links2
.
count
()
+
1
);
// Compare that the link l is equal to link[0] from links in uas
QCOMPARE
(
l
,
static_cast
<
LinkInterface
*>
(
uas
->
getLinks
()
->
at
(
0
)));
// Compare that the link l is equal to link[0] from links in uas through count links
QCOMPARE
(
l
,
static_cast
<
LinkInterface
*>
(
uas
->
getLinks
()
->
at
(
uas
->
getLinks
()
->
count
()
-
1
)));
uas
->
addLink
(
l
);
QCOMPARE
(
uas
->
getLinks
()
->
count
(),
1
);
uas
->
removeLink
(
0
);
// dynamic_cast<QObject*>(l));
QCOMPARE
(
uas
->
getLinks
()
->
count
(),
0
);
}
void
UASUnitTest
::
getWaypointList_test
()
{
QVector
<
Waypoint
*>
kk
=
uas
->
getWaypointManager
()
->
getWaypointList
();
QCOMPARE
(
kk
.
count
(),
0
);
Waypoint
*
wp
=
new
Waypoint
(
0
,
0
,
0
,
0
,
0
,
false
,
false
,
0
,
0
,
MAV_FRAME_GLOBAL
,
MAV_ACTION_NAVIGATE
);
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
,
true
);
kk
=
uas
->
getWaypointManager
()
->
getWaypointList
();
QCOMPARE
(
kk
.
count
(),
1
);
wp
=
new
Waypoint
();
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
,
false
);
kk
=
uas
->
getWaypointManager
()
->
getWaypointList
();
QCOMPARE
(
kk
.
count
(),
2
);
uas
->
getWaypointManager
()
->
removeWaypoint
(
1
);
kk
=
uas
->
getWaypointManager
()
->
getWaypointList
();
QCOMPARE
(
kk
.
count
(),
1
);
uas
->
getWaypointManager
()
->
removeWaypoint
(
0
);
kk
=
uas
->
getWaypointManager
()
->
getWaypointList
();
QCOMPARE
(
kk
.
count
(),
0
);
wp
=
new
Waypoint
();
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
,
true
);
wp
=
new
Waypoint
();
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
,
false
);
// Fail clearWaypointList
//uas->getWaypointManager()->clearWaypointList();
//kk = uas->getWaypointManager()->getWaypointList();
//QCOMPARE(kk.count(), 1);
}
void
UASUnitTest
::
battery_test
()
{
QCOMPARE
(
uas
->
getCommunicationStatus
(),
0
);
}
qgcunittest/UASUnitTest.h
View file @
759715d5
...
@@ -4,10 +4,13 @@
...
@@ -4,10 +4,13 @@
#include <QObject>
#include <QObject>
#include <QtCore/QString>
#include <QtCore/QString>
#include <QtTest/QtTest>
#include <QtTest/QtTest>
#include <QApplication>
#include "UAS.h"
#include "UAS.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkProtocol.h"
#include "UASInterface.h"
#include "UASInterface.h"
#include "AutoTest.h"
#include "AutoTest.h"
#include "LinkManager.h"
class
UASUnitTest
:
public
QObject
class
UASUnitTest
:
public
QObject
{
{
...
@@ -23,6 +26,8 @@ signals:
...
@@ -23,6 +26,8 @@ signals:
private
slots
:
private
slots
:
void
initTestCase
();
void
initTestCase
();
void
cleanupTestCase
();
void
cleanupTestCase
();
void
getUASID_test
();
void
getUASID_test
();
void
getUASName_test
();
void
getUASName_test
();
void
getUpTime_test
();
void
getUpTime_test
();
...
@@ -41,6 +46,15 @@ private slots:
...
@@ -41,6 +46,15 @@ private slots:
void
getPitch_test
();
void
getPitch_test
();
void
getYaw_test
();
void
getYaw_test
();
void
getSelected_test
();
void
getSystemType_test
();
void
getAirframe_test
();
void
getLinks_test
();
void
getWaypointList_test
();
void
battery_test
();
protected:
protected:
UAS
*
prueba
;
UAS
*
prueba
;
...
...
src/ui/SlugsDataSensorView.ui
View file @
759715d5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment