summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2016-05-03 23:19:49 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2016-06-08 09:09:47 +0000
commit982ef5b494319bfaaa585cf0620a821dc3b7c642 (patch)
tree25d87e709f3e12bf722f88716ad1ae18a976b783 /tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
parent997572d85918b1a660414b43a91c619cf294bd39 (diff)
QSharedPointer/QWeakPointer/QScopedPointer: add comparison against nullptr
Some constructors were added, but the comparison operators were missing. The STL has them, so we ought have them too. Change-Id: I030c14a3b355988f509716b4b1b1a835b3ab9481 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp')
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 7998f7b7fd..1bba41816b 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -371,12 +371,22 @@ void tst_QSharedPointer::nullptrOps()
QSharedPointer<char> null;
QVERIFY(p1 == null);
- QVERIFY(p2 == null);
+ QVERIFY(p1 == nullptr);
+ QVERIFY(nullptr == p1);
+ QVERIFY(!p1);
QVERIFY(!p1.data());
+ QVERIFY(p2 == null);
+ QVERIFY(p2 == nullptr);
+ QVERIFY(nullptr == p2);
+ QVERIFY(!p2);
QVERIFY(!p2.data());
+ QVERIFY(p1 == p2);
QSharedPointer<char> p3 = p1;
+ QVERIFY(p3 == p1);
QVERIFY(p3 == null);
+ QVERIFY(p3 == nullptr);
+ QVERIFY(nullptr == p3);
QVERIFY(!p3.data());
p3 = nullptr;
@@ -386,6 +396,16 @@ void tst_QSharedPointer::nullptrOps()
QSharedPointer<char> p2_zero = 0;
p3 = 0;
+
+ QSharedPointer<char> p4(new char);
+ QVERIFY(p4);
+ QVERIFY(p4.data());
+ QVERIFY(p4 != nullptr);
+ QVERIFY(nullptr != p4);
+ QVERIFY(p4 != p1);
+ QVERIFY(p4 != p2);
+ QVERIFY(p4 != null);
+ QVERIFY(p4 != p3);
}
void tst_QSharedPointer::swap()