Commit efb4427b authored by murata's avatar murata

qgcunittest: Change NULL or 0 to nullptr

parent 1cb343fb
...@@ -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);
} }
......
...@@ -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];
} }
} }
......
...@@ -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);
......
...@@ -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)
{ {
} }
......
...@@ -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);
......
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