Cleanup corelib autotests

Use QVERIFY2 to provide better test diagnostics.

Change-Id: I128004f4ee133ceed4d8f373bbbe4a0eee431ebf
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2011-11-10 13:10:40 +10:00 committed by Qt by Nokia
parent a28817fd78
commit 64c8691548
2 changed files with 6 additions and 8 deletions

View File

@ -519,18 +519,13 @@ void tst_QLibrary::fileName()
QLibrary lib(libName);
bool ok = lib.load();
if (!ok) {
qDebug() << lib.errorString();
}
QVERIFY(ok);
QVERIFY2(ok, qPrintable(lib.errorString()));
#if defined(Q_OS_WIN)
QCOMPARE(lib.fileName().toLower(), expectedFilename.toLower());
#else
QCOMPARE(lib.fileName(), expectedFilename);
#endif
QVERIFY(lib.unload());
}
void tst_QLibrary::multipleInstancesForOneLibrary()

View File

@ -229,8 +229,8 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QSemaphore semaphore;
QTime time;
#define QVERIFYGE(a,b) {int e = a; if (a<b) qDebug() << #a << "=" << e << " !>= " << #b << "=" << b; QVERIFY(e>=b);}
#define QVERIFYLE(a,b) {int e = a; if (b<a) qDebug() << #a << "=" << e << " !<= " << #b << "=" << b; QVERIFY(e<=b);}
#define QVERIFYGE(a,b) QVERIFY2(a >= b, qPrintable(QString("%1 = %2 !>= %3 = %4").arg(#a).arg(a).arg(#b).arg(b)));
#define QVERIFYLE(a,b) QVERIFY2(a <= b, qPrintable(QString("%1 = %2 !<= %3 = %4").arg(#a).arg(a).arg(#b).arg(b)));
QCOMPARE(semaphore.available(), 0);
@ -302,6 +302,9 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QVERIFY(!semaphore.tryAcquire(10, timeout));
QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
#undef QVERIFYGE
#undef QVERIFYLE
}
void tst_QSemaphore::tryAcquireWithTimeoutStarvation()