diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-11-04 22:59:09 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-17 11:45:46 +0100 |
commit | 6be39809b038768a665b0e29a3a3668fdc424d9a (patch) | |
tree | 51b29213d4beed589e89a6bcae34874d5f63c593 /tests/auto/corelib/tools | |
parent | 20883c9bcc7882b79db438ed0959530f82c8ee0a (diff) |
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 <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qlist/tst_qlist.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
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<ConstructionCounted>() << 1 << 2); v6 << (QList<ConstructionCounted>() << 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<ConstructionCounted> v7; |