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
73e270fe
Commit
73e270fe
authored
Jan 12, 2011
by
Mariano Lizarraga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some initial unit tests in place for UAS class
parent
9ff341a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
9 deletions
+62
-9
tst_uasunittest.cc
qgcunittest/tst_uasunittest.cc
+58
-5
qgroundcontrol.pri
qgroundcontrol.pri
+4
-4
No files found.
qgcunittest/tst_uasunittest.cc
View file @
73e270fe
...
@@ -2,18 +2,28 @@
...
@@ -2,18 +2,28 @@
#include <QtTest/QtTest>
#include <QtTest/QtTest>
#include "UAS.h"
#include "UAS.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkProtocol.h"
#include "UASInterface.h"
class
UASUnitTest
:
public
QObject
class
UASUnitTest
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
public:
public:
#define UASID 50
MAVLinkProtocol
*
mav
;
UAS
*
uas
;
UASUnitTest
();
UASUnitTest
();
private
Q_SLOTS
:
private
Q_SLOTS
:
void
initTestCase
();
void
initTestCase
();
void
cleanupTestCase
();
void
cleanupTestCase
();
void
testCase1
();
void
getUASID_test
();
void
getUASName_test
();
void
getUpTime_test
();
void
getCommunicationStatus_test
();
private:
};
};
UASUnitTest
::
UASUnitTest
()
UASUnitTest
::
UASUnitTest
()
...
@@ -22,17 +32,60 @@ UASUnitTest::UASUnitTest()
...
@@ -22,17 +32,60 @@ UASUnitTest::UASUnitTest()
void
UASUnitTest
::
initTestCase
()
void
UASUnitTest
::
initTestCase
()
{
{
MAVLinkProtocol
*
mav
=
new
MAVLinkProtocol
();
mav
=
new
MAVLinkProtocol
();
UAS
*
prueba
=
new
UAS
(
mav
,
0
);
uas
=
new
UAS
(
mav
,
UASID
);
}
}
void
UASUnitTest
::
cleanupTestCase
()
void
UASUnitTest
::
cleanupTestCase
()
{
{
delete
uas
;
delete
mav
;
}
void
UASUnitTest
::
getUASID_test
()
{
// Test a default ID of zero is assigned
UAS
*
uas2
=
new
UAS
(
mav
);
QCOMPARE
(
uas2
->
getUASID
(),
0
);
delete
uas2
;
// Test that the chosen ID was assigned at construction
QCOMPARE
(
uas
->
getUASID
(),
UASID
);
// 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
);
QCOMPARE
(
uas
->
getUASID
(),
0
);
}
void
UASUnitTest
::
getUASName_test
()
{
// Test that the name is build as MAV + ID
QCOMPARE
(
uas
->
getUASName
(),
"MAV 0"
+
QString
::
number
(
UASID
));
}
void
UASUnitTest
::
getUpTime_test
()
{
UAS
*
uas2
=
new
UAS
(
mav
);
// Test that the uptime starts at zero to a
// precision of seconds
QCOMPARE
(
floor
(
uas2
->
getUptime
()
/
1000.0
),
0.0
);
// Sleep for three seconds
QTest
::
qSleep
(
3000
);
// Test that the up time is computed correctly to a
// precision of seconds
QCOMPARE
(
floor
(
uas2
->
getUptime
()
/
1000.0
),
3.0
);
delete
uas2
;
}
}
void
UASUnitTest
::
testCase1
()
void
UASUnitTest
::
getCommunicationStatus_test
()
{
{
QVERIFY2
(
true
,
"Failure"
);
// Verify that upon construction the Comm status is disconnected
QCOMPARE
(
uas
->
getCommunicationStatus
(),
static_cast
<
int
>
(
UASInterface
::
COMM_DISCONNECTED
));
}
}
QTEST_APPLESS_MAIN
(
UASUnitTest
);
QTEST_APPLESS_MAIN
(
UASUnitTest
);
...
...
qgroundcontrol.pri
View file @
73e270fe
...
@@ -80,12 +80,12 @@ macx {
...
@@ -80,12 +80,12 @@ macx {
ICON = $$BASEDIR/images/icons/macx.icns
ICON = $$BASEDIR/images/icons/macx.icns
# Copy audio files if needed
# Copy audio files if needed
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/qgroundcontrol.app/Contents/MacO
s
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/qgroundcontrol.app/Contents/MacO
S
# Copy google earth starter file
# Copy google earth starter file
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacO
s
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacO
S
# Copy CSS stylesheets
# Copy CSS stylesheets
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/style-mission.css $$TARGETDIR/qgroundcontrol.app/Contents/MacO
s
/style-indoor.css
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/style-mission.css $$TARGETDIR/qgroundcontrol.app/Contents/MacO
S
/style-indoor.css
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/style-outdoor.css $$TARGETDIR/qgroundcontrol.app/Contents/MacO
s
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/style-outdoor.css $$TARGETDIR/qgroundcontrol.app/Contents/MacO
S
# Copy model files
# Copy model files
#QMAKE_POST_LINK += && cp -f $$BASEDIR/models/*.dae $$TARGETDIR/qgroundcontrol.app/Contents/MacOs
#QMAKE_POST_LINK += && cp -f $$BASEDIR/models/*.dae $$TARGETDIR/qgroundcontrol.app/Contents/MacOs
...
...
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