From 93503b0c525c1a2af5dcc0561562a239ec71d70c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 17 Oct 2022 08:00:15 +0200 Subject: [PATCH] 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 (cherry picked from commit f5205bd6a409d736942a4eed8869245cb9646d35) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp | 1 + .../corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index 3e755e67dac..3c80608217e 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp @@ -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); diff --git a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp index 22b44a027ce..189b11107ef 100644 --- a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp @@ -50,10 +50,12 @@ void tst_QContiguousCache::empty() { QContiguousCache 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);