summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-18 10:42:23 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-18 10:43:24 (GMT)
commit7d2fb4f6dfbfe843ec2d101c06b891230a49d20a (patch)
treedee8ab695061616e45969a647d2bfb51d37f60ba
parent089689914fd7b223c10f5408a6db255ce540e718 (diff)
downloadQt-7d2fb4f6dfbfe843ec2d101c06b891230a49d20a.zip
Qt-7d2fb4f6dfbfe843ec2d101c06b891230a49d20a.tar.gz
Qt-7d2fb4f6dfbfe843ec2d101c06b891230a49d20a.tar.bz2
Autotest: Be very pedant about the tests. There's at least one compiler
where it breaks, so let's find out where.
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index ab75c91..c9b2325 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -761,17 +761,46 @@ void tst_QSharedPointer::differentPointers()
{
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
Data *aBase = aData;
- Q_ASSERT(aData == aBase);
- Q_ASSERT(*reinterpret_cast<quintptr *>(&aData) != *reinterpret_cast<quintptr *>(&aBase));
+
+ // ensure that this compiler isn't broken
+ if (*reinterpret_cast<quintptr *>(&aData) == *reinterpret_cast<quintptr *>(&aBase))
+ qFatal("Something went very wrong -- we couldn't create two different pointers to the same object");
+ if (aData != aBase)
+ QSKIP("Broken compiler", SkipAll);
+ if (aBase != aData)
+ QSKIP("Broken compiler", SkipAll);
QSharedPointer<DiffPtrDerivedData> ptr = QSharedPointer<DiffPtrDerivedData>(aData);
QSharedPointer<Data> baseptr = qSharedPointerCast<Data>(ptr);
- QVERIFY(ptr == baseptr);
+ qDebug("naked: orig: %p; base: %p (%s) -- QSharedPointer: orig: %p; base %p (%s) -- result: %s",
+ aData, aBase, aData == aBase ? "equal" : "not equal",
+ ptr.data(), baseptr.data(), ptr.data() == baseptr.data() ? "equal" : "not equal",
+ baseptr.data() == aData ? "equal" : "not equal");
+
QVERIFY(ptr.data() == baseptr.data());
+ QVERIFY(baseptr.data() == ptr.data());
+ QVERIFY(ptr == baseptr);
+ QVERIFY(baseptr == ptr);
+
+ QVERIFY(ptr.data() == aBase);
+ QVERIFY(aBase == ptr.data());
+ QVERIFY(ptr.data() == aData);
+ QVERIFY(aData == ptr.data());
+
QVERIFY(ptr == aBase);
+ QVERIFY(aBase == ptr);
QVERIFY(ptr == aData);
- QVERIFY(baseptr == aData);
+ QVERIFY(aData == ptr);
+
+ QVERIFY(baseptr.data() == aBase);
+ QVERIFY(aBase == baseptr.data());
QVERIFY(baseptr == aBase);
+ QVERIFY(aBase == baseptr);
+
+ QVERIFY(baseptr.data() == aData);
+ QVERIFY(aData == baseptr.data());
+ QVERIFY(baseptr == aData);
+ QVERIFY(aData == baseptr);
}
check();