Commit efb4427b authored by murata's avatar murata

qgcunittest: Change NULL or 0 to nullptr

parent 1cb343fb
......@@ -18,8 +18,8 @@
#include "QGCApplication.h"
LinkManagerTest::LinkManagerTest(void) :
_linkMgr(NULL),
_multiSpy(NULL)
_linkMgr(nullptr),
_multiSpy(nullptr)
{
}
......@@ -27,8 +27,8 @@ void LinkManagerTest::init(void)
{
UnitTest::init();
Q_ASSERT(_linkMgr == NULL);
Q_ASSERT(_multiSpy == NULL);
Q_ASSERT(_linkMgr == nullptr);
Q_ASSERT(_multiSpy == nullptr);
_linkMgr = qgcApp()->toolbox()->linkManager();
Q_CHECK_PTR(_linkMgr);
......@@ -47,8 +47,8 @@ void LinkManagerTest::cleanup(void)
delete _multiSpy;
_linkMgr = NULL;
_multiSpy = NULL;
_linkMgr = nullptr;
_multiSpy = nullptr;
UnitTest::cleanup();
}
......@@ -91,7 +91,7 @@ void LinkManagerTest::_addSignals_test(void)
QList<QVariant> signalArgs = spy->takeFirst();
QCOMPARE(signalArgs.count(), 1);
QObject* object = qvariant_cast<QObject *>(signalArgs[0]);
QVERIFY(object != NULL);
QVERIFY(object != nullptr);
MockLink* signalLink = qobject_cast<MockLink*>(object);
QCOMPARE(signalLink, _mockLink);
}
......
......@@ -22,8 +22,8 @@
MultiSignalSpy::MultiSignalSpy(QObject* parent) :
QObject(parent),
_signalEmitter(NULL),
_rgSignals(NULL),
_signalEmitter(nullptr),
_rgSignals(nullptr),
_cSignals(0)
{
}
......@@ -55,10 +55,10 @@ bool MultiSignalSpy::init(QObject* signalEmitter, ///< [in] object whi
// Allocate and connect QSignalSpy's
_rgSpys = new QSignalSpy*[_cSignals];
Q_ASSERT(_rgSpys != NULL);
Q_ASSERT(_rgSpys != nullptr);
for (size_t i=0; i<_cSignals; i++) {
_rgSpys[i] = new QSignalSpy(_signalEmitter, _rgSignals[i]);
if (_rgSpys[i] == NULL) {
if (_rgSpys[i] == nullptr) {
qDebug() << "Unabled to allocated QSignalSpy";
return false;
}
......@@ -76,7 +76,7 @@ bool MultiSignalSpy::_checkSignalByMaskWorker(quint32 mask, bool multipleSignals
for (size_t i=0; i<_cSignals; i++) {
if ((1 << i) & mask) {
QSignalSpy* spy = _rgSpys[i];
Q_ASSERT(spy != NULL);
Q_ASSERT(spy != nullptr);
if ((multipleSignalsAllowed && spy->count() == 0) || (!multipleSignalsAllowed && spy->count() != 1)) {
qDebug() << "Failed index:" << i;
......@@ -93,7 +93,7 @@ bool MultiSignalSpy::_checkOnlySignalByMaskWorker(quint32 mask, bool multipleSig
{
for (size_t i=0; i<_cSignals; i++) {
QSignalSpy* spy = _rgSpys[i];
Q_ASSERT(spy != NULL);
Q_ASSERT(spy != nullptr);
if ((1 << i) & mask) {
if ((multipleSignalsAllowed && spy->count() == 0) || (!multipleSignalsAllowed && spy->count() != 1)) {
......@@ -137,7 +137,7 @@ bool MultiSignalSpy::checkNoSignalByMask(quint32 mask)
for (size_t i=0; i<_cSignals; i++) {
if ((1 << i) & mask) {
QSignalSpy* spy = _rgSpys[i];
Q_ASSERT(spy != NULL);
Q_ASSERT(spy != nullptr);
if (spy->count() != 0) {
_printSignalState(mask);
......@@ -159,7 +159,7 @@ bool MultiSignalSpy::checkNoSignals(void)
QSignalSpy* MultiSignalSpy::getSpyByIndex(quint32 index)
{
Q_ASSERT(index < _cSignals);
Q_ASSERT(_rgSpys[index] != NULL);
Q_ASSERT(_rgSpys[index] != nullptr);
return _rgSpys[index];
}
......@@ -168,7 +168,7 @@ QSignalSpy* MultiSignalSpy::getSpyByIndex(quint32 index)
void MultiSignalSpy::clearSignalByIndex(quint32 index)
{
Q_ASSERT(index < _cSignals);
Q_ASSERT(_rgSpys[index] != NULL);
Q_ASSERT(_rgSpys[index] != nullptr);
_rgSpys[index]->clear();
}
......@@ -179,7 +179,7 @@ void MultiSignalSpy::clearSignalsByMask(quint32 mask)
for (size_t i=0; i<_cSignals; i++) {
if ((1 << i) & mask) {
QSignalSpy* spy = _rgSpys[i];
Q_ASSERT(spy != NULL);
Q_ASSERT(spy != nullptr);
spy->clear();
}
......@@ -242,7 +242,7 @@ void MultiSignalSpy::_printSignalState(quint32 mask)
bool expected = (1 << i) & mask;
QSignalSpy* spy = _rgSpys[i];
Q_ASSERT(spy != NULL);
Q_ASSERT(spy != nullptr);
qDebug() << "Signal index:" << i << "count:" << spy->count() << "expected:" << expected << _rgSignals[i];
}
}
......
......@@ -25,7 +25,7 @@ class MultiSignalSpy : public QObject
Q_OBJECT
public:
MultiSignalSpy(QObject* parent = NULL);
MultiSignalSpy(QObject* parent = nullptr);
~MultiSignalSpy();
bool init(QObject* signalEmitter, const char** rgSignals, size_t cSignals);
......
......@@ -17,8 +17,8 @@
#include "TCPLoopBackServer.h"
TCPLinkTest::TCPLinkTest(void)
: _link(NULL)
, _multiSpy(NULL)
: _link(nullptr)
, _multiSpy(nullptr)
{
}
......
......@@ -18,7 +18,7 @@
TCPLoopBackServer::TCPLoopBackServer(QHostAddress hostAddress, quint16 port) :
_hostAddress(hostAddress),
_port(port),
_tcpSocket(NULL)
_tcpSocket(nullptr)
{
moveToThread(this);
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