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
efb4427b
Commit
efb4427b
authored
Aug 11, 2019
by
murata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qgcunittest: Change NULL or 0 to nullptr
parent
1cb343fb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
22 deletions
+22
-22
LinkManagerTest.cc
src/qgcunittest/LinkManagerTest.cc
+7
-7
MultiSignalSpy.cc
src/qgcunittest/MultiSignalSpy.cc
+11
-11
MultiSignalSpy.h
src/qgcunittest/MultiSignalSpy.h
+1
-1
TCPLinkTest.cc
src/qgcunittest/TCPLinkTest.cc
+2
-2
TCPLoopBackServer.cc
src/qgcunittest/TCPLoopBackServer.cc
+1
-1
No files found.
src/qgcunittest/LinkManagerTest.cc
View file @
efb4427b
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
#include "QGCApplication.h"
#include "QGCApplication.h"
LinkManagerTest
::
LinkManagerTest
(
void
)
:
LinkManagerTest
::
LinkManagerTest
(
void
)
:
_linkMgr
(
NULL
),
_linkMgr
(
nullptr
),
_multiSpy
(
NULL
)
_multiSpy
(
nullptr
)
{
{
}
}
...
@@ -27,8 +27,8 @@ void LinkManagerTest::init(void)
...
@@ -27,8 +27,8 @@ void LinkManagerTest::init(void)
{
{
UnitTest
::
init
();
UnitTest
::
init
();
Q_ASSERT
(
_linkMgr
==
NULL
);
Q_ASSERT
(
_linkMgr
==
nullptr
);
Q_ASSERT
(
_multiSpy
==
NULL
);
Q_ASSERT
(
_multiSpy
==
nullptr
);
_linkMgr
=
qgcApp
()
->
toolbox
()
->
linkManager
();
_linkMgr
=
qgcApp
()
->
toolbox
()
->
linkManager
();
Q_CHECK_PTR
(
_linkMgr
);
Q_CHECK_PTR
(
_linkMgr
);
...
@@ -47,8 +47,8 @@ void LinkManagerTest::cleanup(void)
...
@@ -47,8 +47,8 @@ void LinkManagerTest::cleanup(void)
delete
_multiSpy
;
delete
_multiSpy
;
_linkMgr
=
NULL
;
_linkMgr
=
nullptr
;
_multiSpy
=
NULL
;
_multiSpy
=
nullptr
;
UnitTest
::
cleanup
();
UnitTest
::
cleanup
();
}
}
...
@@ -91,7 +91,7 @@ void LinkManagerTest::_addSignals_test(void)
...
@@ -91,7 +91,7 @@ void LinkManagerTest::_addSignals_test(void)
QList
<
QVariant
>
signalArgs
=
spy
->
takeFirst
();
QList
<
QVariant
>
signalArgs
=
spy
->
takeFirst
();
QCOMPARE
(
signalArgs
.
count
(),
1
);
QCOMPARE
(
signalArgs
.
count
(),
1
);
QObject
*
object
=
qvariant_cast
<
QObject
*>
(
signalArgs
[
0
]);
QObject
*
object
=
qvariant_cast
<
QObject
*>
(
signalArgs
[
0
]);
QVERIFY
(
object
!=
NULL
);
QVERIFY
(
object
!=
nullptr
);
MockLink
*
signalLink
=
qobject_cast
<
MockLink
*>
(
object
);
MockLink
*
signalLink
=
qobject_cast
<
MockLink
*>
(
object
);
QCOMPARE
(
signalLink
,
_mockLink
);
QCOMPARE
(
signalLink
,
_mockLink
);
}
}
...
...
src/qgcunittest/MultiSignalSpy.cc
View file @
efb4427b
...
@@ -22,8 +22,8 @@
...
@@ -22,8 +22,8 @@
MultiSignalSpy
::
MultiSignalSpy
(
QObject
*
parent
)
:
MultiSignalSpy
::
MultiSignalSpy
(
QObject
*
parent
)
:
QObject
(
parent
),
QObject
(
parent
),
_signalEmitter
(
NULL
),
_signalEmitter
(
nullptr
),
_rgSignals
(
NULL
),
_rgSignals
(
nullptr
),
_cSignals
(
0
)
_cSignals
(
0
)
{
{
}
}
...
@@ -55,10 +55,10 @@ bool MultiSignalSpy::init(QObject* signalEmitter, ///< [in] object whi
...
@@ -55,10 +55,10 @@ bool MultiSignalSpy::init(QObject* signalEmitter, ///< [in] object whi
// Allocate and connect QSignalSpy's
// Allocate and connect QSignalSpy's
_rgSpys
=
new
QSignalSpy
*
[
_cSignals
];
_rgSpys
=
new
QSignalSpy
*
[
_cSignals
];
Q_ASSERT
(
_rgSpys
!=
NULL
);
Q_ASSERT
(
_rgSpys
!=
nullptr
);
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
_rgSpys
[
i
]
=
new
QSignalSpy
(
_signalEmitter
,
_rgSignals
[
i
]);
_rgSpys
[
i
]
=
new
QSignalSpy
(
_signalEmitter
,
_rgSignals
[
i
]);
if
(
_rgSpys
[
i
]
==
NULL
)
{
if
(
_rgSpys
[
i
]
==
nullptr
)
{
qDebug
()
<<
"Unabled to allocated QSignalSpy"
;
qDebug
()
<<
"Unabled to allocated QSignalSpy"
;
return
false
;
return
false
;
}
}
...
@@ -76,7 +76,7 @@ bool MultiSignalSpy::_checkSignalByMaskWorker(quint32 mask, bool multipleSignals
...
@@ -76,7 +76,7 @@ bool MultiSignalSpy::_checkSignalByMaskWorker(quint32 mask, bool multipleSignals
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
if
((
1
<<
i
)
&
mask
)
{
if
((
1
<<
i
)
&
mask
)
{
QSignalSpy
*
spy
=
_rgSpys
[
i
];
QSignalSpy
*
spy
=
_rgSpys
[
i
];
Q_ASSERT
(
spy
!=
NULL
);
Q_ASSERT
(
spy
!=
nullptr
);
if
((
multipleSignalsAllowed
&&
spy
->
count
()
==
0
)
||
(
!
multipleSignalsAllowed
&&
spy
->
count
()
!=
1
))
{
if
((
multipleSignalsAllowed
&&
spy
->
count
()
==
0
)
||
(
!
multipleSignalsAllowed
&&
spy
->
count
()
!=
1
))
{
qDebug
()
<<
"Failed index:"
<<
i
;
qDebug
()
<<
"Failed index:"
<<
i
;
...
@@ -93,7 +93,7 @@ bool MultiSignalSpy::_checkOnlySignalByMaskWorker(quint32 mask, bool multipleSig
...
@@ -93,7 +93,7 @@ bool MultiSignalSpy::_checkOnlySignalByMaskWorker(quint32 mask, bool multipleSig
{
{
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
QSignalSpy
*
spy
=
_rgSpys
[
i
];
QSignalSpy
*
spy
=
_rgSpys
[
i
];
Q_ASSERT
(
spy
!=
NULL
);
Q_ASSERT
(
spy
!=
nullptr
);
if
((
1
<<
i
)
&
mask
)
{
if
((
1
<<
i
)
&
mask
)
{
if
((
multipleSignalsAllowed
&&
spy
->
count
()
==
0
)
||
(
!
multipleSignalsAllowed
&&
spy
->
count
()
!=
1
))
{
if
((
multipleSignalsAllowed
&&
spy
->
count
()
==
0
)
||
(
!
multipleSignalsAllowed
&&
spy
->
count
()
!=
1
))
{
...
@@ -137,7 +137,7 @@ bool MultiSignalSpy::checkNoSignalByMask(quint32 mask)
...
@@ -137,7 +137,7 @@ bool MultiSignalSpy::checkNoSignalByMask(quint32 mask)
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
if
((
1
<<
i
)
&
mask
)
{
if
((
1
<<
i
)
&
mask
)
{
QSignalSpy
*
spy
=
_rgSpys
[
i
];
QSignalSpy
*
spy
=
_rgSpys
[
i
];
Q_ASSERT
(
spy
!=
NULL
);
Q_ASSERT
(
spy
!=
nullptr
);
if
(
spy
->
count
()
!=
0
)
{
if
(
spy
->
count
()
!=
0
)
{
_printSignalState
(
mask
);
_printSignalState
(
mask
);
...
@@ -159,7 +159,7 @@ bool MultiSignalSpy::checkNoSignals(void)
...
@@ -159,7 +159,7 @@ bool MultiSignalSpy::checkNoSignals(void)
QSignalSpy
*
MultiSignalSpy
::
getSpyByIndex
(
quint32
index
)
QSignalSpy
*
MultiSignalSpy
::
getSpyByIndex
(
quint32
index
)
{
{
Q_ASSERT
(
index
<
_cSignals
);
Q_ASSERT
(
index
<
_cSignals
);
Q_ASSERT
(
_rgSpys
[
index
]
!=
NULL
);
Q_ASSERT
(
_rgSpys
[
index
]
!=
nullptr
);
return
_rgSpys
[
index
];
return
_rgSpys
[
index
];
}
}
...
@@ -168,7 +168,7 @@ QSignalSpy* MultiSignalSpy::getSpyByIndex(quint32 index)
...
@@ -168,7 +168,7 @@ QSignalSpy* MultiSignalSpy::getSpyByIndex(quint32 index)
void
MultiSignalSpy
::
clearSignalByIndex
(
quint32
index
)
void
MultiSignalSpy
::
clearSignalByIndex
(
quint32
index
)
{
{
Q_ASSERT
(
index
<
_cSignals
);
Q_ASSERT
(
index
<
_cSignals
);
Q_ASSERT
(
_rgSpys
[
index
]
!=
NULL
);
Q_ASSERT
(
_rgSpys
[
index
]
!=
nullptr
);
_rgSpys
[
index
]
->
clear
();
_rgSpys
[
index
]
->
clear
();
}
}
...
@@ -179,7 +179,7 @@ void MultiSignalSpy::clearSignalsByMask(quint32 mask)
...
@@ -179,7 +179,7 @@ void MultiSignalSpy::clearSignalsByMask(quint32 mask)
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
if
((
1
<<
i
)
&
mask
)
{
if
((
1
<<
i
)
&
mask
)
{
QSignalSpy
*
spy
=
_rgSpys
[
i
];
QSignalSpy
*
spy
=
_rgSpys
[
i
];
Q_ASSERT
(
spy
!=
NULL
);
Q_ASSERT
(
spy
!=
nullptr
);
spy
->
clear
();
spy
->
clear
();
}
}
...
@@ -242,7 +242,7 @@ void MultiSignalSpy::_printSignalState(quint32 mask)
...
@@ -242,7 +242,7 @@ void MultiSignalSpy::_printSignalState(quint32 mask)
bool
expected
=
(
1
<<
i
)
&
mask
;
bool
expected
=
(
1
<<
i
)
&
mask
;
QSignalSpy
*
spy
=
_rgSpys
[
i
];
QSignalSpy
*
spy
=
_rgSpys
[
i
];
Q_ASSERT
(
spy
!=
NULL
);
Q_ASSERT
(
spy
!=
nullptr
);
qDebug
()
<<
"Signal index:"
<<
i
<<
"count:"
<<
spy
->
count
()
<<
"expected:"
<<
expected
<<
_rgSignals
[
i
];
qDebug
()
<<
"Signal index:"
<<
i
<<
"count:"
<<
spy
->
count
()
<<
"expected:"
<<
expected
<<
_rgSignals
[
i
];
}
}
}
}
...
...
src/qgcunittest/MultiSignalSpy.h
View file @
efb4427b
...
@@ -25,7 +25,7 @@ class MultiSignalSpy : public QObject
...
@@ -25,7 +25,7 @@ class MultiSignalSpy : public QObject
Q_OBJECT
Q_OBJECT
public:
public:
MultiSignalSpy
(
QObject
*
parent
=
NULL
);
MultiSignalSpy
(
QObject
*
parent
=
nullptr
);
~
MultiSignalSpy
();
~
MultiSignalSpy
();
bool
init
(
QObject
*
signalEmitter
,
const
char
**
rgSignals
,
size_t
cSignals
);
bool
init
(
QObject
*
signalEmitter
,
const
char
**
rgSignals
,
size_t
cSignals
);
...
...
src/qgcunittest/TCPLinkTest.cc
View file @
efb4427b
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
#include "TCPLoopBackServer.h"
#include "TCPLoopBackServer.h"
TCPLinkTest
::
TCPLinkTest
(
void
)
TCPLinkTest
::
TCPLinkTest
(
void
)
:
_link
(
NULL
)
:
_link
(
nullptr
)
,
_multiSpy
(
NULL
)
,
_multiSpy
(
nullptr
)
{
{
}
}
...
...
src/qgcunittest/TCPLoopBackServer.cc
View file @
efb4427b
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
TCPLoopBackServer
::
TCPLoopBackServer
(
QHostAddress
hostAddress
,
quint16
port
)
:
TCPLoopBackServer
::
TCPLoopBackServer
(
QHostAddress
hostAddress
,
quint16
port
)
:
_hostAddress
(
hostAddress
),
_hostAddress
(
hostAddress
),
_port
(
port
),
_port
(
port
),
_tcpSocket
(
NULL
)
_tcpSocket
(
nullptr
)
{
{
moveToThread
(
this
);
moveToThread
(
this
);
start
(
HighPriority
);
start
(
HighPriority
);
...
...
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