forked from qt-creator/qt-creator
Fix perfresourcecounter test
If qrand() generates a 0, the obtain() is ignored as that is the invalid ID. Change-Id: I608f2687a6ca9a40d905c665a3585bffc1ea5695 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -140,9 +140,10 @@ void PerfResourceCounterTest::testUnitSized()
|
|||||||
QList<int> ids;
|
QList<int> ids;
|
||||||
for (int i = 0; i < 10000; ++i) {
|
for (int i = 0; i < 10000; ++i) {
|
||||||
counter.request(1);
|
counter.request(1);
|
||||||
int id = qrand();
|
const int id = qrand();
|
||||||
counter.obtain(id);
|
counter.obtain(id);
|
||||||
ids.append(id);
|
if (id != 0) // Otherwise it's the invalid ID and that means the allocation "failed".
|
||||||
|
ids.append(id);
|
||||||
QCOMPARE(counter.currentTotal(), ids.length());
|
QCOMPARE(counter.currentTotal(), ids.length());
|
||||||
}
|
}
|
||||||
QCOMPARE(sum(container), counter.currentTotal());
|
QCOMPARE(sum(container), counter.currentTotal());
|
||||||
|
Reference in New Issue
Block a user