summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-07-19 23:37:17 +0200
committerhjk <hjk121@nokiamail.com>2014-07-22 10:47:45 +0200
commit776da7b5b3f2609495da96eeb2f587ddfe320c0d (patch)
treeccf1ea52e12b82adafa3069db14e9fb7b4508de9 /tests
parent543958c3be3863af5bf8c6b9206bdcfccaac3b41 (diff)
downloadqt-creator-776da7b5b3f2609495da96eeb2f587ddfe320c0d.tar.gz
Debugger: Improve associative std container display
Handle multimap and multiset. Use the "[index] key" display that's also used for Q{Multi,}Map both for consistency and because it's needed to distiguish otherwise identical keys. Change-Id: Ib9e369206bce89e5e27d1f6f60ead11ca88e2dcb Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/debugger/tst_dumpers.cpp41
-rw-r--r--tests/manual/debugger/simple/simple_test_app.cpp28
2 files changed, 60 insertions, 9 deletions
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp
index e3b79fd1c6..412656a7fc 100644
--- a/tests/auto/debugger/tst_dumpers.cpp
+++ b/tests/auto/debugger/tst_dumpers.cpp
@@ -3728,22 +3728,33 @@ void tst_Dumpers::dumper_data()
"Map::iterator it4 = it3; ++it4;\n"
"Map::iterator it5 = it4; ++it5;\n"
"Map::iterator it6 = it5; ++it6;\n"
- "unused(&it6);\n")
+ "unused(&it6);\n"
+
+ "std::multimap<unsigned int, float> map4;\n"
+ "map4.insert(std::pair<unsigned int, float>(11, 11.0));\n"
+ "map4.insert(std::pair<unsigned int, float>(22, 22.0));\n"
+ "map4.insert(std::pair<unsigned int, float>(22, 23.0));\n"
+ "map4.insert(std::pair<unsigned int, float>(22, 24.0));\n"
+ "map4.insert(std::pair<unsigned int, float>(22, 25.0));\n")
+ Check("map1", "<2 items>", "std::map<unsigned int, unsigned int>")
- + Check("map1.11", "[11]", "1", "unsigned int")
- + Check("map1.22", "[22]", "2", "unsigned int")
+ + Check("map1.0", "[0] 11", "1", "unsigned int")
+ + Check("map1.1", "[1] 22", "2", "unsigned int")
+ Check("map2", "<2 items>", "std::map<unsigned int, float>")
- + Check("map2.11", "[11]", "11", "float")
- + Check("map2.22", "[22]", "22", "float")
+ + Check("map2.0", "[0] 11", "11", "float")
+ + Check("map2.1", "[1] 22", "22", "float")
+ Check("map3", "<6 items>", "Map")
- + Check("map3.11", "[11]", "11", "float")
+ + Check("map3.0", "[0] 11", "11", "float")
+ Check("it1.first", "11", "int")
+ Check("it1.second", "11", "float")
+ Check("it6.first", "66", "int")
- + Check("it6.second", "66", "float");
+ + Check("it6.second", "66", "float")
+
+ + Check("map4", "<5 items>", "std::multimap<unsigned int, float>")
+ + Check("map4.0", "[0] 11", "11", "float")
+ + Check("map4.4", "[4] 22", "25", "float");
QTest::newRow("StdMapQt")
@@ -3911,7 +3922,15 @@ void tst_Dumpers::dumper_data()
"Set::iterator it1 = s2.begin();\n"
"Set::iterator it2 = it1; ++it2;\n"
"Set::iterator it3 = it2; ++it3;\n"
- "unused(&it3);\n")
+ "unused(&it3);\n\n"
+
+ "std::multiset<int> s3;\n"
+ "s3.insert(1);\n"
+ "s3.insert(1);\n"
+ "s3.insert(2);\n"
+ "s3.insert(3);\n"
+ "s3.insert(3);\n"
+ "s3.insert(3);\n")
+ Check("s0", "<0 items>", "std::set<double>")
@@ -3919,7 +3938,11 @@ void tst_Dumpers::dumper_data()
+ Check("s2", "<3 items>", "Set")
+ Check("it1.value", "11", "int")
- + Check("it3.value", "33", "int");
+ + Check("it3.value", "33", "int")
+
+ + Check("s3", "<6 items>", "std::multiset<int>")
+ + Check("s3.0", "[0]", "1", "int")
+ + Check("s3.5", "[5]", "3", "int");
QTest::newRow("StdSetQt")
diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp
index c7f46d4429..dfda50eb32 100644
--- a/tests/manual/debugger/simple/simple_test_app.cpp
+++ b/tests/manual/debugger/simple/simple_test_app.cpp
@@ -3262,6 +3262,32 @@ namespace stdmap {
dummyStatement(&map);
}
+ void testStdMultiMapUIntFloat()
+ {
+ typedef std::pair<uint, float> V;
+ std::multimap<uint, float> map;
+ map.insert(V(11, 11.0));
+ map.insert(V(22, 22.0));
+ map.insert(V(22, 33.0));
+ map.insert(V(22, 34.0));
+ map.insert(V(22, 35.0));
+ map.insert(V(22, 36.0));
+ BREAK_HERE;
+ // Expand map.
+ // Check map <6 items> std:multimap<unsigned int, float>.
+ // Check map.0 11 float.
+ // Check map.5 22 float.
+ // Continue.
+ dummyStatement(&map);
+ }
+
+ void testStdMultiSetInt()
+ {
+ std::multiset<int> set = {1, 1, 2, 3, 3, 3};
+ BREAK_HERE;
+ dummyStatement(&set);
+ }
+
void testStdMap()
{
testStdMapStringFoo();
@@ -3274,6 +3300,8 @@ namespace stdmap {
testStdMapStringFloat();
testStdMapIntString();
testStdMapStringPointer();
+ testStdMultiMapUIntFloat();
+ testStdMultiSetInt();
}
} // namespace stdmap