Commit 063075ec authored by hjk's avatar hjk
Browse files

Debugger: Merge more test cases



Change-Id: I478b4bfb5fa615b2ea982ca6635c5e8e3478070c
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 5deb0f36
......@@ -1724,213 +1724,212 @@ void tst_Dumpers::dumper_data()
<< Data("#include <QImage>\n"
"#include <QApplication>\n"
"#include <QPainter>\n",
"QApplication app(argc, argv);\n"
"QImage im(QSize(200, 200), QImage::Format_RGB32);\n"
"im.fill(QColor(200, 100, 130).rgba());\n"
"QPainter pain;\n"
"pain.begin(&im);\n"
"unused(&pain, &im);\n")
% GuiProfile()
% Check("im", "(200x200)", "@QImage")
% CheckType("pain", "@QPainter");
QTest::newRow("QPixmap")
<< Data("#include <QImage>\n"
"#include <QPainter>\n"
"#include <QApplication>\n",
"QApplication app(argc, argv);\n"
"QImage im(QSize(200, 200), QImage::Format_RGB32);\n"
"im.fill(QColor(200, 100, 130).rgba());\n"
"im.fill(QColor(200, 100, 130).rgba());\n\n"
"QPainter pain;\n"
"pain.begin(&im);\n"
"pain.drawLine(2, 2, 130, 130);\n"
"pain.end();\n"
"QPixmap pm = QPixmap::fromImage(im);\n"
"unused(&pm);\n")
% GuiProfile()
% Check("im", "(200x200)", "@QImage")
% CheckType("pain", "@QPainter")
% Check("pm", "(200x200)", "@QPixmap");
QTest::newRow("QLinkedList")
<< Data("#include <QLinkedList>\n"
"#include <string>\n"
+ fooData,
"QLinkedList<int> list1;\n"
"list1.append(101);\n"
"list1.append(102);\n\n"
"QLinkedList<float> l0;\n"
"unused(&l0);\n\n"
"QLinkedList<int> l1;\n"
"l1.append(101);\n"
"l1.append(102);\n"
"unused(&l1);\n\n"
"QLinkedList<uint> list2;\n"
"list2.append(103);\n"
"list2.append(104);\n\n"
"QLinkedList<uint> l2;\n"
"l2.append(103);\n"
"l2.append(104);\n"
"unused(&l2);\n\n"
"QLinkedList<Foo *> list3;\n"
"list3.append(new Foo(1));\n"
"list3.append(0);\n"
"list3.append(new Foo(3));\n\n"
"QLinkedList<Foo *> l3;\n"
"l3.append(new Foo(1));\n"
"l3.append(0);\n"
"l3.append(new Foo(3));\n"
"unused(&l3);\n\n"
"QLinkedList<qulonglong> list4;\n"
"list4.append(42);\n"
"list4.append(43);\n\n"
"QLinkedList<qulonglong> l4;\n"
"l4.append(42);\n"
"l4.append(43);\n"
"unused(&l4);\n\n"
"QLinkedList<Foo> list5;\n"
"list5.append(Foo(1));\n"
"list5.append(Foo(2));\n\n"
"QLinkedList<Foo> l5;\n"
"l5.append(Foo(1));\n"
"l5.append(Foo(2));\n"
"unused(&l5);\n\n"
"QLinkedList<std::string> list6;\n"
"list6.push_back(\"aa\");\n"
"list6.push_back(\"bb\");\n")
"QLinkedList<std::string> l6;\n"
"l6.push_back(\"aa\");\n"
"l6.push_back(\"bb\");\n"
"unused(&l6);\n\n")
% CoreProfile()
% Check("list1", "<2 items>", "@QLinkedList<int>")
% Check("list1.0", "[0]", "101", "int")
% Check("list1.1", "[1]", "102", "int")
% Check("l0", "<0 items>", "@QLinkedList<float>")
% Check("list2", "<2 items>", "@QLinkedList<unsigned int>")
% Check("list2.0", "[0]", "103", "unsigned int")
% Check("list2.1", "[1]", "104", "unsigned int")
% Check("l1", "<2 items>", "@QLinkedList<int>")
% Check("l1.0", "[0]", "101", "int")
% Check("l1.1", "[1]", "102", "int")
% Check("list3", "<3 items>", "@QLinkedList<Foo*>")
% CheckType("list3.0", "[0]", "Foo")
% Check("list3.0.a", "1", "int")
% Check("list3.1", "[1]", "0x0", "Foo *")
% CheckType("list3.2", "[2]", "Foo")
% Check("list3.2.a", "3", "int")
% Check("l2", "<2 items>", "@QLinkedList<unsigned int>")
% Check("l2.0", "[0]", "103", "unsigned int")
% Check("l2.1", "[1]", "104", "unsigned int")
% Check("list4", "<2 items>", "@QLinkedList<unsigned long long>")
% Check("list4.0", "[0]", "42", "unsigned long long")
% Check("list4.1", "[1]", "43", "unsigned long long")
% Check("l3", "<3 items>", "@QLinkedList<Foo*>")
% CheckType("l3.0", "[0]", "Foo")
% Check("l3.0.a", "1", "int")
% Check("l3.1", "[1]", "0x0", "Foo *")
% CheckType("l3.2", "[2]", "Foo")
% Check("l3.2.a", "3", "int")
% Check("list5", "<2 items>", "@QLinkedList<Foo>")
% CheckType("list5.0", "[0]", "Foo")
% Check("list5.0.a", "1", "int")
% CheckType("list5.1", "[1]", "Foo")
% Check("list5.1.a", "2", "int")
% Check("l4", "<2 items>", "@QLinkedList<unsigned long long>")
% Check("l4.0", "[0]", "42", "unsigned long long")
% Check("l4.1", "[1]", "43", "unsigned long long")
% Check("list6", "<2 items>", "@QLinkedList<std::string>")
% Check("list6.0", "[0]", "\"aa\"", "std::string")
% Check("list6.1", "[1]", "\"bb\"", "std::string");
% Check("l5", "<2 items>", "@QLinkedList<Foo>")
% CheckType("l5.0", "[0]", "Foo")
% Check("l5.0.a", "1", "int")
% CheckType("l5.1", "[1]", "Foo")
% Check("l5.1.a", "2", "int")
% Check("l6", "<2 items>", "@QLinkedList<std::string>")
% Check("l6.0", "[0]", "\"aa\"", "std::string")
% Check("l6.1", "[1]", "\"bb\"", "std::string");
QTest::newRow("QListInt")
<< Data("#include <QList>\n",
"QList<int> big;\n"
"for (int i = 0; i < 10000; ++i)\n"
" big.push_back(i);\n")
% CoreProfile()
% Check("big", "<10000 items>", "@QList<int>")
% Check("big.0", "[0]", "0", "int")
% Check("big.1999", "[1999]", "1999", "int");
QTest::newRow("QListIntTakeFirst")
<< Data("#include <QList>\n",
"QList<int> l;\n"
"l.append(0);\n"
"l.append(1);\n"
"l.append(2);\n"
"l.takeFirst();\n")
% CoreProfile()
% Check("l", "<2 items>", "@QList<int>")
% Check("l.0", "[0]", "1", "int");
QTest::newRow("QListStringTakeFirst")
QTest::newRow("QList")
<< Data("#include <QList>\n"
"#include <QString>\n",
"QList<QString> l;\n"
"l.append(\"0\");\n"
"l.append(\"1\");\n"
"l.append(\"2\");\n"
"l.takeFirst();\n")
% CoreProfile()
% Check("l", "<2 items>", "@QList<@QString>")
% Check("l.0", "[0]", "\"1\"", "@QString");
"#include <QChar>\n"
"#include <QStringList>\n",
QTest::newRow("QStringListTakeFirst")
<< Data("#include <QStringList>\n",
"QStringList l;\n"
"l.append(\"0\");\n"
"l.append(\"1\");\n"
"l.append(\"2\");\n"
"l.takeFirst();\n")
% CoreProfile()
% Check("l", "<2 items>", "@QStringList")
% Check("l.0", "[0]", "\"1\"", "@QString");
QTest::newRow("QListIntStar")
<< Data("#include <QList>\n",
"QList<int *> l0, l;\n"
"l.append(new int(1));\n"
"l.append(new int(2));\n"
"l.append(new int(3));\n")
% CoreProfile()
% Check("l0", "<0 items>", "@QList<int*>")
% Check("l", "<3 items>", "@QList<int*>")
% CheckType("l.0", "[0]", "int")
% CheckType("l.2", "[2]", "int");
QTest::newRow("QListUInt")
<< Data("#include <QList>\n",
"QList<uint> l0,l;\n"
"l.append(101);\n"
"l.append(102);\n"
"l.append(102);\n")
% CoreProfile()
% Check("l0", "<0 items>", "@QList<unsigned int>")
% Check("l", "<3 items>", "@QList<unsigned int>")
% Check("l.0", "[0]", "101", "unsigned int")
% Check("l.2", "[2]", "102", "unsigned int");
"QList<int> l0;\n"
"unused(&l0);\n\n"
QTest::newRow("QListStringList")
<< Data("#include <QStringList>\n",
"QStringList l;\n"
"l.append(\"aaa\");\n"
"QList<QStringList> ll;\n"
"ll.append(l);\n"
"ll.append(l);\n")
% CoreProfile()
% Check("ll", "<2 items>", "@QList<@QStringList>")
% Check("l", "<1 items>", "@QStringList")
% Check("ll.1", "[1]", "<1 items>", "@QStringList")
% Check("ll.1.0", "[0]", "\"aaa\"", "@QString");
QTest::newRow("QListUShort")
<< Data("#include <QList>\n",
"QList<ushort> l0,l;\n"
"l.append(101);\n"
"l.append(102);\n"
"l.append(102);\n")
% CoreProfile()
% Check("l0", "<0 items>", "@QList<unsigned short>")
% Check("l", "<3 items>", "@QList<unsigned short>")
% Check("l.0", "[0]", "101", "unsigned short")
% Check("l.2", "[2]", "102", "unsigned short");
"QList<int> l1;\n"
"for (int i = 0; i < 10000; ++i)\n"
" l1.push_back(i);\n"
"unused(&l1);\n\n"
"QList<int> l2;\n"
"l2.append(0);\n"
"l2.append(1);\n"
"l2.append(2);\n"
"l2.takeFirst();\n"
"unused(&l2);\n\n"
"QList<QString> l3;\n"
"l3.append(\"0\");\n"
"l3.append(\"1\");\n"
"l3.append(\"2\");\n"
"l3.takeFirst();\n"
"unused(&l3);\n\n"
"QStringList l4;\n"
"l4.append(\"0\");\n"
"l4.append(\"1\");\n"
"l4.append(\"2\");\n"
"l4.takeFirst();\n"
"unused(&l4);\n\n"
"QList<int *> l5;\n"
"l5.append(new int(1));\n"
"l5.append(new int(2));\n"
"l5.append(0);\n"
"unused(&l5);\n\n"
"QList<int *> l6;\n"
"unused(&l6);\n\n"
"QList<uint> l7;\n"
"l7.append(101);\n"
"l7.append(102);\n"
"l7.append(102);\n"
"unused(&l7);\n\n"
"QStringList sl;\n"
"sl.append(\"aaa\");\n"
"QList<QStringList> l8;\n"
"l8.append(sl);\n"
"l8.append(sl);\n"
"unused(&l8, &sl);\n\n"
"QList<ushort> l9;\n"
"l9.append(101);\n"
"l9.append(102);\n"
"l9.append(102);\n"
"unused(&l9);\n\n"
"QList<QChar> l10;\n"
"l10.append(QChar('a'));\n"
"l10.append(QChar('b'));\n"
"l10.append(QChar('c'));\n"
"unused(&l10);\n\n"
"QList<qulonglong> l11;\n"
"l11.append(101);\n"
"l11.append(102);\n"
"l11.append(102);\n"
"unused(&l11);\n\n")
QTest::newRow("QListQChar")
<< Data("#include <QList>\n"
"#include <QChar>\n",
"QList<QChar> l0, l;\n"
"l.append(QChar('a'));\n"
"l.append(QChar('b'));\n"
"l.append(QChar('c'));\n")
% CoreProfile()
% Check("l0", "<0 items>", "@QList<@QChar>")
% Check("l", "<3 items>", "@QList<@QChar>")
% Check("l.0", "[0]", "97", "@QChar")
% Check("l.2", "[2]", "99", "@QChar");
QTest::newRow("QListQULongLong")
<< Data("#include <QList>\n",
"QList<qulonglong> l0, l;\n"
"l.append(101);\n"
"l.append(102);\n"
"l.append(102);\n")
% CoreProfile()
% Check("l0", "<0 items>", "@QList<unsigned long long>")
% Check("l", "<3 items>", "@QList<unsigned long long>")
% Check("l.0", "[0]", "101", "unsigned long long")
% Check("l.2", "[2]", "102", "unsigned long long");
% Check("l0", "<0 items>", "@QList<int>")
% Check("l1", "<10000 items>", "@QList<int>")
% Check("l1.0", "[0]", "0", "int")
% Check("l1.999", "[999]", "999", "int")
% Check("l2", "<2 items>", "@QList<int>")
% Check("l2.0", "[0]", "1", "int")
% Check("l3", "<2 items>", "@QList<@QString>")
% Check("l3.0", "[0]", "\"1\"", "@QString")
% Check("l4", "<2 items>", "@QStringList")
% Check("l4.0", "[0]", "\"1\"", "@QString")
% Check("l5", "<3 items>", "@QList<int*>")
% CheckType("l5.0", "[0]", "int")
% CheckType("l5.1", "[1]", "int")
% Check("l5.2", "[2]", "0x0", "int*")
% Check("l6", "<0 items>", "@QList<int*>")
% Check("l7", "<3 items>", "@QList<unsigned int>")
% Check("l7.0", "[0]", "101", "unsigned int")
% Check("l7.2", "[2]", "102", "unsigned int")
% Check("l8", "<2 items>", "@QList<@QStringList>")
% Check("sl", "<1 items>", "@QStringList")
% Check("l8.1", "[1]", "<1 items>", "@QStringList")
% Check("l8.1.0", "[0]", "\"aaa\"", "@QString")
% Check("l9", "<3 items>", "@QList<unsigned short>")
% Check("l9.0", "[0]", "101", "unsigned short")
% Check("l9.2", "[2]", "102", "unsigned short")
% Check("l10", "<3 items>", "@QList<@QChar>")
% Check("l10.0", "[0]", "97", "@QChar")
% Check("l10.2", "[2]", "99", "@QChar");
QTest::newRow("QListStdString")
<< Data("#include <QList>\n"
......@@ -2000,33 +1999,40 @@ void tst_Dumpers::dumper_data()
% Check("m1", Value4("ImperialSystem"),
"@QLocale::MeasurementSystem").setForLldbOnly();
QTest::newRow("QMapUIntStringList")
<< Data("#include <QMap>\n"
"#include <QStringList>\n",
"QMap<uint, QStringList> map;\n"
"map[11] = QStringList() << \"11\";\n"
"map[22] = QStringList() << \"22\";\n")
% CoreProfile()
% Check("map", "<2 items>", "@QMap<unsigned int, @QStringList>")
% Check("map.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>")
% Check("map.0.key", "11", "unsigned int")
% Check("map.0.value", "<1 items>", "@QStringList")
% Check("map.0.value.0", "[0]", "\"11\"", "@QString")
% Check("map.1", "[1]", "", "@QMapNode<unsigned int, @QStringList>")
% Check("map.1.key", "22", "unsigned int")
% Check("map.1.value", "<1 items>", "@QStringList")
% Check("map.1.value.0", "[0]", "\"22\"", "@QString");
QTest::newRow("QMapUIntStringListTypedef")
QTest::newRow("QMap")
<< Data("#include <QMap>\n"
"#include <QStringList>\n",
"QMap<uint, QStringList> m0;\n"
"unused(&m0);\n\n"
"QMap<uint, QStringList> m1;\n"
"m1[11] = QStringList() << \"11\";\n"
"m1[22] = QStringList() << \"22\";\n"
"typedef QMap<uint, QStringList> T;\n"
"T map;\n"
"map[11] = QStringList() << \"11\";\n"
"map[22] = QStringList() << \"22\";\n")
"T m3;\n"
"m3[11] = QStringList() << \"11\";\n"
"m3[22] = QStringList() << \"22\";\n")
% CoreProfile()
% Check("map", "<2 items>", "T")
% Check("map.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>");
% Check("m0", "<0 items>", "@QMap<unsigned int, @QStringList>")
% Check("m1", "<2 items>", "@QMap<unsigned int, @QStringList>")
% Check("m1.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>")
% Check("m1.0.key", "11", "unsigned int")
% Check("m1.0.value", "<1 items>", "@QStringList")
% Check("m1.0.value.0", "[0]", "\"11\"", "@QString")
% Check("m1.1", "[1]", "", "@QMapNode<unsigned int, @QStringList>")
% Check("m1.1.key", "22", "unsigned int")
% Check("m1.1.value", "<1 items>", "@QStringList")
% Check("m1.1.value.0", "[0]", "\"22\"", "@QString")
% Check("m3", "<2 items>", "T")
% Check("m3.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>");
QTest::newRow("QMapUIntFloat")
<< Data("#include <QMap>\n",
......@@ -2599,70 +2605,66 @@ void tst_Dumpers::dumper_data()
" };\n";
QTest::newRow("QSharedPointer1")
<< Data("#include <QSharedPointer>\n",
"QSharedPointer<int> ptr;\n"
"QSharedPointer<int> ptr2 = ptr;\n"
"QSharedPointer<int> ptr3 = ptr;\n"
"unused(&ptr, &ptr2, &ptr3);\n")
% CoreProfile()
% Check("ptr", "(null)", "@QSharedPointer<int>")
% Check("ptr2", "(null)", "@QSharedPointer<int>")
% Check("ptr3", "(null)", "@QSharedPointer<int>");
QTest::newRow("QSharedPointer2")
<< Data("#include <QSharedPointer>\n",
"QSharedPointer<QString> ptr(new QString(\"hallo\"));\n"
"QSharedPointer<QString> ptr2 = ptr;\n"
"QSharedPointer<QString> ptr3 = ptr;\n"
"unused(&ptr, &ptr2, &ptr3);\n")
% CoreProfile()
% Check("ptr", "", "@QSharedPointer<@QString>")
% Check("ptr.data", "\"hallo\"", "@QString")
% Check("ptr.weakref", "3", "int")
% Check("ptr.strongref", "3", "int")
% Check("ptr2.data", "\"hallo\"", "@QString")
% Check("ptr3.data", "\"hallo\"", "@QString");
QTest::newRow("QSharedPointer3")
<< Data("#include <QSharedPointer>\n",
"QSharedPointer<int> iptr(new int(43));\n"
"QWeakPointer<int> ptr(iptr);\n"
"QWeakPointer<int> ptr2 = ptr;\n"
"QWeakPointer<int> ptr3 = ptr;\n"
"unused(&ptr, &ptr2, &ptr3);\n")
% CoreProfile()
% Check("iptr", "43", "@QSharedPointer<int>")
% Check("iptr.data", "43", "int")
% Check("iptr.weakref", "4", "int")
% Check("iptr.strongref", "1", "int")
% Check("ptr3", "43", "@QWeakPointer<int>")
% Check("ptr3.data", "43", "int");
QTest::newRow("QSharedPointer4")
QTest::newRow("QSharedPointer")
<< Data("#include <QSharedPointer>\n"
"#include <QString>\n",
"QSharedPointer<QString> sptr(new QString(\"hallo\"));\n"
"QWeakPointer<QString> ptr(sptr);\n"
"QWeakPointer<QString> ptr2 = ptr;\n"
"QWeakPointer<QString> ptr3 = ptr;\n"
"unused(&ptr, &ptr2, &ptr3);\n")
% CoreProfile()
% Check("sptr", "", "@QSharedPointer<@QString>")
% Check("sptr.data", "\"hallo\"", "@QString")
% Check("ptr3", "", "@QWeakPointer<@QString>");
QTest::newRow("QSharedPointer5")
<< Data("#include <QSharedPointer>\n" + fooData,
"QSharedPointer<Foo> fptr(new Foo(1));\n"
"QWeakPointer<Foo> ptr(fptr);\n"
"QWeakPointer<Foo> ptr2 = ptr;\n"
"QWeakPointer<Foo> ptr3 = ptr;\n"
"unused(&ptr, &ptr2, &ptr3);\n")
"#include <QString>\n" + fooData,
"QSharedPointer<int> ptr10;\n"
"QSharedPointer<int> ptr11 = ptr10;\n"
"QSharedPointer<int> ptr12 = ptr10;\n"
"unused(&ptr10, &ptr11, &ptr12);\n\n"
"QSharedPointer<QString> ptr20(new QString(\"hallo\"));\n"
"QSharedPointer<QString> ptr21 = ptr20;\n"
"QSharedPointer<QString> ptr22 = ptr20;\n"
"unused(&ptr20, &ptr21, &ptr21);\n\n"
"QSharedPointer<int> ptr30(new int(43));\n"
"QWeakPointer<int> ptr31(ptr30);\n"
"QWeakPointer<int> ptr32 = ptr31;\n"
"QWeakPointer<int> ptr33 = ptr32;\n"
"unused(&ptr30, &ptr31, &ptr32);\n\n"
"QSharedPointer<QString> ptr40(new QString(\"hallo\"));\n"
"QWeakPointer<QString> ptr41(ptr40);\n"
"QWeakPointer<QString> ptr42 = ptr40;\n"
"QWeakPointer<QString> ptr43 = ptr40;\n"
"unused(&ptr40, &ptr41, &ptr42, &ptr43);\n\n"
"QSharedPointer<Foo> ptr50(new Foo(1));\n"
"QWeakPointer<Foo> ptr51(ptr50);\n"
"QWeakPointer<Foo> ptr52 = ptr50;\n"
"QWeakPointer<Foo> ptr53 = ptr50;\n"
"unused(&ptr50, &ptr51, &ptr52, &ptr53);\n")
% CoreProfile()
% Check("fptr", "", "@QSharedPointer<Foo>")
% Check("fptr.data", "", "Foo")
% Check("ptr3", "", "@QWeakPointer<Foo>");
% Check("ptr10", "(null)", "@QSharedPointer<int>")
% Check("ptr11", "(null)", "@QSharedPointer<int>")
% Check("ptr12", "(null)", "@QSharedPointer<int>")
% Check("ptr20", "", "@QSharedPointer<@QString>")
% Check("ptr20.data", "\"hallo\"", "@QString")
% Check("ptr20.weakref", "3", "int")
% Check("ptr20.strongref", "3", "int")
% Check("ptr21.data", "\"hallo\"", "@QString")
% Check("ptr22.data", "\"hallo\"", "@QString")
% Check("ptr30", "43", "@QSharedPointer<int>")
% Check("ptr30.data", "43", "int")
% Check("ptr30.weakref", "4", "int")
% Check("ptr30.strongref", "1", "int")
% Check("ptr33", "43", "@QWeakPointer<int>")
% Check("ptr33.data", "43", "int")
% Check("ptr40", "", "@QSharedPointer<@QString>")
% Check("ptr40.data", "\"hallo\"", "@QString")
% Check("ptr43", "", "@QWeakPointer<@QString>")
% Check("ptr50", "", "@QSharedPointer<Foo>")
% Check("ptr50.data", "", "Foo")
% Check("ptr53", "", "@QWeakPointer<Foo>");
QTest::newRow("QXmlAttributes")
<< Data("#include <QXmlAttributes>\n",
......@@ -2690,6 +2692,7 @@ void tst_Dumpers::dumper_data()
% Check("atts.attList.2.uri", "\"uri3\"", "@QString")
% Check("atts.attList.2.value", "\"value3\"", "@QString");
QTest::newRow("StdArray")
<< Data("#include <array>\n"
"#include <QString>\n",
......@@ -2704,6 +2707,7 @@ void tst_Dumpers::dumper_data()
% Check("b", "<4 items>", Pattern("std::array<@QString, 4.*>"))
% Check("b.0", "[0]", "\"1\"", "@QString");
QTest::newRow("StdComplex")
<< Data("#include <complex>\n",
"std::complex<double> c(1, 2);\n"
......@@ -2711,6 +2715,7 @@ void tst_Dumpers::dumper_data()