diff options
Diffstat (limited to 'tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index a9fd282ac9..8a621cd5d9 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -2155,7 +2155,7 @@ void tst_QSharedPointer::threadStressTest() } } -template<typename Container, bool Ordered> +template<typename Container, bool Ordered, bool Multi> void hashAndMapTest() { typedef typename Container::key_type Key; @@ -2200,26 +2200,30 @@ void hashAndMapTest() QVERIFY(it == c.end()); } - c.insertMulti(k1, Value(47)); - it = c.find(k1); - QVERIFY(it != c.end()); - QCOMPARE(it.key(), k1); - ++it; - QVERIFY(it != c.end()); - QCOMPARE(it.key(), k1); - ++it; - if (Ordered) - QVERIFY(it == c.end()); + if (Multi) { + c.insert(k1, Value(47)); + it = c.find(k1); + QVERIFY(it != c.end()); + QCOMPARE(it.key(), k1); + ++it; + QVERIFY(it != c.end()); + QCOMPARE(it.key(), k1); + ++it; + if (Ordered) + QVERIFY(it == c.end()); + } } void tst_QSharedPointer::map() { - hashAndMapTest<QMap<QSharedPointer<int>, int>, true>(); + hashAndMapTest<QMap<QSharedPointer<int>, int>, true, false>(); + hashAndMapTest<QMultiMap<QSharedPointer<int>, int>, true, true>(); } void tst_QSharedPointer::hash() { - hashAndMapTest<QHash<QSharedPointer<int>, int>, false>(); + hashAndMapTest<QHash<QSharedPointer<int>, int>, false, false>(); + hashAndMapTest<QMultiHash<QSharedPointer<int>, int>, false, true>(); } void tst_QSharedPointer::validConstructs() |