tst_Q{BitArray,ContiguousCache}: check not only count(), but size(), too

Add at least a few, so size() isn't completely untested.

Change-Id: I500d28f7efb30ab578808d8fefb6ea57949edc2e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit f5205bd6a409d736942a4eed8869245cb9646d35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-10-17 08:00:15 +02:00 committed by Qt Cherry-pick Bot
parent 2a14dd4f47
commit 93503b0c52
2 changed files with 3 additions and 0 deletions

View File

@ -143,6 +143,7 @@ void tst_QBitArray::countBits()
bits.setBit(i);
}
QCOMPARE(bits.size(), numBits);
QCOMPARE(bits.count(), numBits);
QCOMPARE(bits.count(true), onBits);
QCOMPARE(bits.count(false), numBits - onBits);

View File

@ -50,10 +50,12 @@ void tst_QContiguousCache::empty()
{
QContiguousCache<int> c(10);
QCOMPARE(c.capacity(), 10);
QCOMPARE(c.size(), 0);
QCOMPARE(c.count(), 0);
QVERIFY(c.isEmpty());
c.append(1);
QCOMPARE(c.count(), 1);
QCOMPARE(c.size(), 1);
QVERIFY(!c.isEmpty());
c.clear();
QCOMPARE(c.capacity(), 10);