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,8 +140,9 @@ void PerfResourceCounterTest::testUnitSized()
|
||||
QList<int> ids;
|
||||
for (int i = 0; i < 10000; ++i) {
|
||||
counter.request(1);
|
||||
int id = qrand();
|
||||
const int id = qrand();
|
||||
counter.obtain(id);
|
||||
if (id != 0) // Otherwise it's the invalid ID and that means the allocation "failed".
|
||||
ids.append(id);
|
||||
QCOMPARE(counter.currentTotal(), ids.length());
|
||||
}
|
||||
|
Reference in New Issue
Block a user