summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-05-28 15:43:28 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-05-28 15:46:42 +0200
commit9228b527f2fa95aad7f34cbc44905fb8b371bbf7 (patch)
tree0b4a7c9c1fcf461fabe5e2d41fac98d462fcc630
parent881746fd74d475265e442a1dc02b32ddb6c2d898 (diff)
test QMultiMap::operator+= and QMultiHash::operator+=
-rw-r--r--tests/auto/qhash/tst_qhash.cpp20
-rw-r--r--tests/auto/qmap/tst_qmap.cpp20
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qhash/tst_qhash.cpp b/tests/auto/qhash/tst_qhash.cpp
index 59576d9470..3a7b54acce 100644
--- a/tests/auto/qhash/tst_qhash.cpp
+++ b/tests/auto/qhash/tst_qhash.cpp
@@ -1154,6 +1154,26 @@ void tst_QHash::qmultihash_specific()
QVERIFY(i.key() == 9);
QVERIFY(i.value() == 98);
}
+
+ {
+ QMultiHash<int, int> map1;
+ map1.insert(42, 1);
+ map1.insert(10, 2);
+ map1.insert(48, 3);
+ QMultiHash<int, int> map2;
+ map2.insert(8, 4);
+ map2.insert(42, 5);
+ map2.insert(95, 12);
+
+ map1+=map2;
+ map2.insert(42, 1);
+ map2.insert(10, 2);
+ map2.insert(48, 3);
+ QCOMPARE(map1.count(), map2.count());
+ QVERIFY(map1.remove(42,5));
+ QVERIFY(map2.remove(42,5));
+ QVERIFY(map1 == map2);
+ }
}
template <typename T>
diff --git a/tests/auto/qmap/tst_qmap.cpp b/tests/auto/qmap/tst_qmap.cpp
index d3ed76dcd4..a1b8de72fd 100644
--- a/tests/auto/qmap/tst_qmap.cpp
+++ b/tests/auto/qmap/tst_qmap.cpp
@@ -837,6 +837,26 @@ void tst_QMap::qmultimap_specific()
QVERIFY(i.key() == 9);
QVERIFY(i.value() == 98);
}
+
+ {
+ QMultiMap<int, int> map1;
+ map1.insert(42, 1);
+ map1.insert(10, 2);
+ map1.insert(48, 3);
+ QMultiMap<int, int> map2;
+ map2.insert(8, 4);
+ map2.insert(42, 5);
+ map2.insert(95, 12);
+
+ map1+=map2;
+ map2.insert(42, 1);
+ map2.insert(10, 2);
+ map2.insert(48, 3);
+ QCOMPARE(map1.count(), map2.count());
+ QVERIFY(map1.remove(42,5));
+ QVERIFY(map2.remove(42,5));
+ QVERIFY(map1 == map2);
+ }
}
QTEST_APPLESS_MAIN(tst_QMap)