summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib/tools/qmap
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-07-21 18:38:57 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-07-23 17:19:18 +0200
commitebae6e2041bcbe5b86fa13f779c952896e9c68d6 (patch)
treecacca8a12dd409639dcb5235a87fe33a8528065f /tests/benchmarks/corelib/tools/qmap
parent23434f487b05c5230085f61f3f7370e74d3eb6ca (diff)
Assert some more things we can be sure of in the QMap benchmark
Just in case the test isn't testing what we think it is. One of my earlier changes didn't until this told me about it. Change-Id: Idd6f415d543509cabb3a64219736bb43e60a70ef Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/benchmarks/corelib/tools/qmap')
-rw-r--r--tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.cpp b/tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.cpp
index 48321d9eb2..c8df971e3c 100644
--- a/tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.cpp
+++ b/tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.cpp
@@ -95,6 +95,7 @@ void tst_QMap::insertion_int_int()
for (int i = 0; i < huge; ++i)
map.insert(i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_int_intx()
@@ -106,6 +107,7 @@ void tst_QMap::insertion_int_intx()
for (int i = 0; i < huge; ++i)
map.insert(i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_int_int_with_hint1()
@@ -115,6 +117,7 @@ void tst_QMap::insertion_int_int_with_hint1()
for (int i = 0; i < huge; ++i)
map.insert(map.constEnd(), i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_int_int2()
@@ -124,6 +127,7 @@ void tst_QMap::insertion_int_int2()
for (int i = huge; i >= 0; --i)
map.insert(i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge) + 1);
}
void tst_QMap::insertion_int_int_with_hint2()
@@ -133,6 +137,7 @@ void tst_QMap::insertion_int_int_with_hint2()
for (int i = huge; i >= 0; --i)
map.insert(map.constBegin(), i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge) + 1);
}
void tst_QMap::insertion_int_string()
@@ -143,16 +148,19 @@ void tst_QMap::insertion_int_string()
for (int i = 0; i < huge; ++i)
map.insert(i, str);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_string_int()
{
QMap<QString, int> map;
const QStringList names = helloEachWorld(huge);
+ QCOMPARE(names.size(), qsizetype(huge));
QBENCHMARK {
for (int i = 1; i < huge; ++i)
map.insert(names.at(i), i);
}
+ QCOMPARE(map.size() + 1, qsizetype(huge));
}
void tst_QMap::lookup_int_int()
@@ -160,6 +168,7 @@ void tst_QMap::lookup_int_int()
QMap<int, int> map;
for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
uint sum = 0, count = 0;
QBENCHMARK {
@@ -176,6 +185,7 @@ void tst_QMap::lookup_int_string()
QString str("Hello World");
for (int i = 0; i < huge; ++i)
map.insert(i, str);
+ QCOMPARE(map.size(), qsizetype(huge));
QBENCHMARK {
for (int i = 0; i < huge; ++i)
@@ -189,6 +199,7 @@ void tst_QMap::lookup_string_int()
const QStringList names = helloEachWorld(huge);
for (int i = 1; i < huge; ++i)
map.insert(names.at(i), i);
+ QCOMPARE(map.size() + 1, qsizetype(huge));
uint sum = 0, count = 0;
QBENCHMARK {
@@ -205,6 +216,7 @@ void tst_QMap::iteration()
QMap<int, int> map;
for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
uint sum = 0, count = 0;
QBENCHMARK {
@@ -226,6 +238,7 @@ void tst_QMap::toStdMap()
QMap<int, int> map;
for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
QBENCHMARK {
std::map<int, int> n = map.toStdMap();
@@ -238,6 +251,7 @@ void tst_QMap::iterator_begin()
QMap<int, int> map;
for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
QBENCHMARK {
for (int i = 0; i < huge; ++i) {
@@ -254,6 +268,7 @@ void tst_QMap::ctorStdMap()
std::map<int, int> map;
for (int i = 0; i < huge; ++i)
map.insert(std::pair<int, int>(i, i));
+ QCOMPARE(map.size(), size_t(huge));
QBENCHMARK {
QMap<int, int> qmap(map);
@@ -280,6 +295,7 @@ void tst_QMap::insertion_string_int2()
map.insert(str, i);
}
}
+ QCOMPARE(map.size() + 1, qsizetype(bigish));
}
void tst_QMap::insertion_string_int2_hint()
@@ -292,6 +308,7 @@ void tst_QMap::insertion_string_int2_hint()
map.insert(map.end(), str, i);
}
}
+ QCOMPARE(map.size() + 1, qsizetype(bigish));
}
void tst_QMap::insertMap()