From 6be39809b038768a665b0e29a3a3668fdc424d9a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 4 Nov 2020 22:59:09 +0100 Subject: Simplify reallocation handling in QList Have one generic method for detaching and reallocations. Use that method throughout QList to avoid duplicated instantiations of code paths that are rarely used. Change-Id: I5b9add3be5f17b387e2d34028b72c8f52db68444 Reviewed-by: Andrei Golubev Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp | 2 +- tests/auto/corelib/tools/qlist/tst_qlist.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index bb76caed3e..68e8a26cb2 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -2079,7 +2079,7 @@ void tst_QArrayData::dataPointerAllocate() const auto freeAtBegin = newDataPointer.freeSpaceAtBegin(); const auto freeAtEnd = newDataPointer.freeSpaceAtEnd(); - QVERIFY(newAlloc > oldDataPointer.constAllocatedCapacity()); + QVERIFY(newAlloc >= oldDataPointer.constAllocatedCapacity()); QCOMPARE(freeAtBegin + freeAtEnd, newAlloc); if (GrowthPosition == QArrayData::GrowsAtBeginning) { QVERIFY(freeAtBegin > 0); diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index 7f07b45473..37b1e9487f 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -874,8 +874,8 @@ void tst_QList::appendList() const v6 << (QList() << 1 << 2); v6 << (QList() << 3 << 4); QCOMPARE(v6, expectedFour); - QCOMPARE(v6.at(0).copies, 2); - QCOMPARE(v6.at(0).moves, 1); + QCOMPARE(v6.at(0).copies, 1); + QCOMPARE(v6.at(0).moves, 3); // += QList v7; -- cgit v1.2.3