summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-02-05 15:11:54 +0100
committerLars Knoll <lars.knoll@qt.io>2020-03-14 10:36:47 +0100
commitd013aa16ef4255d01a6704102e00555fc7167b03 (patch)
tree9413bd8ab60c7494a96fd627afba5ba0f7bddfb9 /tests/auto
parentbf7debf658ce65ada062c9a129320c7356becfd1 (diff)
Extend QContiguousCache to use qsizetype for size and indices
Allow for more than 2^31 items and large offsets. Change-Id: I42f7bf20ce0e4af43dbb2e2083abf0e232e68282 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp
index f305d63d46..b25ed55648 100644
--- a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp
+++ b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp
@@ -106,25 +106,25 @@ void tst_QContiguousCache::swap()
void tst_QContiguousCache::append_data()
{
- QTest::addColumn<int>("start");
- QTest::addColumn<int>("count");
- QTest::addColumn<int>("cacheSize");
+ QTest::addColumn<qsizetype>("start");
+ QTest::addColumn<qsizetype>("count");
+ QTest::addColumn<qsizetype>("cacheSize");
QTest::addColumn<bool>("invalidIndexes");
- QTest::newRow("0+30[10]") << 0 << 30 << 10 << false;
- QTest::newRow("300+30[10]") << 300 << 30 << 10 << false;
- QTest::newRow("MAX-10+30[10]") << INT_MAX-10 << 30 << 10 << true;
+ QTest::newRow("0+30[10]") << qsizetype(0) << qsizetype(30) << qsizetype(10) << false;
+ QTest::newRow("300+30[10]") << qsizetype(300) << qsizetype(30) << qsizetype(10) << false;
+ QTest::newRow("MAX-10+30[10]") << std::numeric_limits<qsizetype>::max()-10 << qsizetype(30) << qsizetype(10) << true;
}
void tst_QContiguousCache::append()
{
- QFETCH(int, start);
- QFETCH(int, count);
- QFETCH(int, cacheSize);
+ QFETCH(qsizetype, start);
+ QFETCH(qsizetype, count);
+ QFETCH(qsizetype, cacheSize);
QFETCH(bool, invalidIndexes);
- int i, j;
- QContiguousCache<int> c(cacheSize);
+ qsizetype i, j;
+ QContiguousCache<qsizetype> c(cacheSize);
i = 1;
QCOMPARE(c.available(), cacheSize);
@@ -134,8 +134,8 @@ void tst_QContiguousCache::append()
c.insert(start, i++);
while (i < count) {
c.append(i);
- QCOMPARE(c.available(), qMax(0, cacheSize - i));
- QCOMPARE(c.first(), qMax(1, i-cacheSize+1));
+ QCOMPARE(c.available(), qMax(qsizetype(0), cacheSize - i));
+ QCOMPARE(c.first(), qMax(qsizetype(1), i-cacheSize+1));
QCOMPARE(c.last(), i);
QCOMPARE(c.count(), qMin(i, cacheSize));
QCOMPARE(c.isFull(), i >= cacheSize);