summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qhash/tst_qhash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qhash/tst_qhash.cpp')
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 9c96aaf78d..77baed87c2 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -1327,10 +1327,15 @@ void tst_QHash::twoArguments_qHash()
void tst_QHash::initializerList()
{
#ifdef Q_COMPILER_INITIALIZER_LISTS
- QHash<int, QString> hash{{1, "hello"}, {2, "initializer_list"}};
+ QHash<int, QString> hash = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
QCOMPARE(hash.count(), 2);
- QVERIFY(hash[1] == "hello");
- QVERIFY(hash[2] == "initializer_list");
+ QCOMPARE(hash[1], QString("hello"));
+ QCOMPARE(hash[2], QString("initializer_list"));
+
+ // note the difference to std::unordered_map:
+ // std::unordered_map<int, QString> stdh = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
+ // QCOMPARE(stdh.size(), 2UL);
+ // QCOMPARE(stdh[1], QString("bar"));
QMultiHash<QString, int> multiHash{{"il", 1}, {"il", 2}, {"il", 3}};
QCOMPARE(multiHash.count(), 3);