OSDN Git Service

Debugger simple test case: Move BREAK_HERE
[qt-creator-jp/qt-creator-jp.git] / tests / manual / debugger / simple / simple_test_app.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 ////////////////  Some global configuration below ////////////////
34
35
36 // The following defines can be used to steer the kind of tests that
37 // can be done.
38
39 // With USE_AUTORUN, creator will automatically "execute" the commands
40 // in a comment following a BREAK_HERE line.
41 // The following commands are supported:
42 //   // Check <name> <value> <type>
43 //         - Checks whether the local variable is displayed with value and type.
44 //   // CheckType <name> <type>
45 //         - Checks whether the local variable is displayed with type.
46 //           The value is untested, so it can be used with pointers values etc.
47 //           that would change between test runs
48 //   // Continue
49 //       - Continues execution
50 // On the TODO list:
51 //   // Expand <name1>[ <name2> ...].
52 //         - Expands local variables with given names.
53 //           There should be at most one "Expand" line per BREAK_HERE,
54 //           and this should placed on the line following the BREAK_HERE
55 //           FIXME: Not implemented yet.
56
57
58 // Value: 1
59 // If the line after a BREAK_HERE line does not contain one of the
60 // supported commands, the test stops.
61 // Value: 2
62 // Same as 1, except that the debugger will stop automatically when
63 // a test after a BREAK_HERE failed
64 // Default: 0
65 // Before using this, make sure that "Show a message box when receiving a signal"
66 // is disabled in "Tools" -> "Options..." -> "Debugger" -> "GDB".
67 #ifndef USE_AUTORUN
68 #define USE_AUTORUN 0
69 #endif
70
71 // With USE_AUTOBREAK, the debugger will stop automatically on all
72 // lines containing the BREAK_HERE macro. This should be enabled
73 // during manual testing.
74 // Default: 0
75 #ifndef USE_AUTOBREAK
76 #define USE_AUTOBREAK 0
77 #endif
78
79 // With USE_UNINITIALIZED_AUTOBREAK, the debugger will stop automatically
80 // on all lines containing the BREAK_UNINITIALIZED_HERE macro.
81 // This should be enabled during manual testing.
82 // Default: 0
83 #ifndef USE_UNINITIALIZED_AUTOBREAK
84 #define USE_UNINITIALIZED_AUTOBREAK 0
85 #endif
86
87
88 ////////////// No further global configuration below ////////////////
89
90 // AUTORUN is only sensibly with AUTOBREAK and without UNINITIALIZED_AUTOBREAK
91 #if USE_AUTORUN
92 #if !(USE_AUTOBREAK)
93 #undef USE_AUTOBREAK
94 #define USE_AUTOBREAK 1
95 #warning Switching on USE_AUTOBREAK
96 #endif // !USE_AUTOBREAK
97 #if USE_UNINITIALIZED_AUTOBREAK
98 #undef USE_UNINITIALIZED_AUTOBREAK
99 #define USE_UNINITIALIZED_AUTOBREAK 0
100 #warning Switching off USE_AUTOBREAK
101 #endif // USE_UNINITIALIZED_AUTOBREAK
102 #endif
103
104 #if QT_SCRIPT_LIB
105 #define USE_SCRIPTLIB 1
106 #else
107 #define USE_SCRIPTLIB 0
108 #endif
109
110 #if QT_VERSION >= 0x040500
111 #define USE_SHARED_POINTER 1
112 #else
113 #define USE_SHARED_POINTER 0
114 #endif
115
116 void dummyStatement(...) {}
117
118 #if USE_CXX11 && defined(__GNUC__) && defined(__STRICT_ANSI__)
119 #undef __STRICT_ANSI__ // working around compile error with MinGW
120 #endif
121
122 #include <QDebug>
123 #include <QDateTime>
124 #include <QDir>
125 #include <QHash>
126 #include <QLibrary>
127 #include <QLinkedList>
128 #include <QList>
129 #include <QMap>
130 #include <QPointer>
131 #include <QProcess>
132 #include <QRegExp>
133 #include <QString>
134 #include <QStringList>
135 #include <QSettings>
136 #include <QStack>
137 #include <QThread>
138 #include <QVariant>
139 #include <QVector>
140 #include <QUrl>
141 #if USE_SHARED_POINTER
142 #include <QSharedPointer>
143 #endif
144
145 #include <QColor>
146 #include <QFont>
147
148 //#include <QtGui/private/qfixed_p.h>
149 #include <QPainter>
150 #include <QPainterPath>
151 #include <QRegion>
152
153 #include <QTextCursor>
154 #include <QTextDocument>
155
156 #if USE_SCRIPTLIB
157 #include <QScriptEngine>
158 #include <QScriptValue>
159 #endif
160
161 #include <QXmlAttributes>
162
163 #include <QHostAddress>
164 #include <QNetworkRequest>
165
166 #include <QApplication> // QWidgets: Separate module as of Qt 5
167 #include <QAction>
168 #include <QStandardItemModel>
169 #include <QLabel>
170
171 #if USE_CXX11
172 #include <array>
173 #endif
174 #include <complex>
175 #include <deque>
176 #include <iostream>
177 #include <iterator>
178 #include <fstream>
179 #include <map>
180 #include <memory>
181 #include <list>
182 #include <limits>
183 #include <set>
184 #include <stack>
185 #include <string>
186 #include <vector>
187
188 #include <stdarg.h>
189
190 #include "../simple/deep/deep/simple_test_app.h"
191
192
193 #if USE_BOOST
194 #include <boost/optional.hpp>
195 #include <boost/shared_ptr.hpp>
196 #include <boost/date_time.hpp>
197 #include <boost/date_time/gregorian/gregorian.hpp>
198 #include <boost/date_time/posix_time/posix_time.hpp>
199 #endif
200
201 #if USE_EIGEN
202 #include <eigen2/Eigen/Core>
203 #endif
204
205 #if USE_PRIVATE
206 #include <private/qobject_p.h>
207 #endif
208
209 #if defined(__GNUC__) && !defined(__llvm__) && !defined(Q_OS_MAC)
210 #    define USE_GCC_EXT 1
211 #    undef __DEPRECATED
212 #    include <ext/hash_set>
213 #endif
214
215 #ifdef Q_OS_WIN
216 #include <windows.h>
217 #undef min
218 #undef max
219 #endif
220
221 #ifdef __SSE__
222 #include <xmmintrin.h>
223 #include <stddef.h>
224 #endif
225
226 #if USE_AUTOBREAK
227 #   ifdef Q_CC_MSVC
228 #       define BREAK_HERE __asm { int 3 }; __asm { mov eax, eax }
229 #   else
230 #       define BREAK_HERE asm("int $3; mov %eax, %eax")
231 #   endif
232 #else
233 #   define BREAK_HERE dummyStatement()
234 #endif
235
236 #if USE_UNINITIALIZED_AUTOBREAK
237 #   ifdef Q_CC_MSVC
238 #       define BREAK_UNINITIALIZED_HERE __asm { int 3 }; __asm { mov eax, eax }
239 #   else
240 #       define BREAK_UNINITIALIZED_HERE asm("int $3; mov %eax, %eax")
241 #   endif
242 #else
243 #   define BREAK_UNINITIALIZED_HERE dummyStatement()
244 #endif
245
246
247 QT_BEGIN_NAMESPACE
248 uint qHash(const QMap<int, int> &) { return 0; }
249 uint qHash(const double & f) { return int(f); }
250 uint qHash(const QPointer<QObject> &p) { return (ulong)p.data(); }
251 QT_END_NAMESPACE
252
253
254 namespace nsA {
255 namespace nsB {
256
257 struct SomeType
258 {
259     SomeType(int a) : a(a) {}
260     int a;
261 };
262
263 } // namespace nsB
264 } // namespace nsA
265
266
267 namespace multibp {
268
269     // This tests multiple breakpoints. When a
270     // the b
271     template <typename T> class Vector
272     {
273     public:
274         explicit Vector(int size)
275             : m_size(size), m_data(new T[size])
276         {
277             BREAK_HERE;
278             // Check size 10 int.
279             // Continue.
280             // Check there are multiple entries in the Breakpoint vie.
281             dummyStatement(this);
282         }
283         ~Vector() { delete [] m_data; }
284         int size() const { return m_size; }
285     private:
286         int m_size;
287         T *m_data;
288     };
289
290     void testMultiBp()
291     {
292         Vector<int> vi(10);
293         Vector<float> vf(10);
294         Vector<double> vd(10);
295         Vector<char> vc(10);
296         dummyStatement(&vi, &vf, &vd, &vc);
297     }
298
299 } // namespace multibp
300
301
302
303
304 class Foo
305 {
306 public:
307     Foo(int i = 0)
308         : a(i), b(2)
309     {
310         int s = 1;
311         int t = 2;
312         b = 2 + s + t;
313         dummyStatement(&s, &t);
314     }
315
316     virtual ~Foo()
317     {
318         a = 5;
319     }
320
321     void doit()
322     {
323         static QObject ob;
324         m["1"] = "2";
325         h[&ob] = m.begin();
326
327         a += 1;
328         --b;
329         dummyStatement(&a, &b);
330     }
331
332 public:
333     int a, b;
334     char x[6];
335
336 private:
337     typedef QMap<QString, QString> Map;
338     Map m;
339     QHash<QObject *, Map::iterator> h;
340 };
341
342 class X : virtual public Foo { public: X() { } };
343
344 class XX : virtual public Foo { public: XX() { } };
345
346 class Y : virtual public Foo { public: Y() { } };
347
348 class D : public X, public Y { int diamond; };
349
350
351 namespace peekandpoke {
352
353     void testAnonymousStructs()
354     {
355         #ifndef Q_CC_RVCT
356         union {
357             struct { int i; int b; };
358             struct { float f; };
359             double d;
360         } a = { { 42, 43 } };
361         BREAK_HERE;
362         // Expand a.
363         // CheckType a union {...}.
364         // Check a.b 43 int.
365         // Check a.d 9.1245819032257467e-313 double.
366         // Check a.f 5.88545355e-44 float.
367         // Check a.i 42 int.
368         // Continue.
369
370         a.i = 1;
371         BREAK_HERE;
372         // Expand a.
373         // CheckType a union {...}.
374         // Check a.b 43 int.
375         // Check a.d 9.1245819012000775e-313 double.
376         // Check a.f 1.40129846e-45 float.
377         // Check a.i 1 int.
378         // Continue.
379
380         a.i = 2;
381         BREAK_HERE;
382         // Expand a.
383         // CheckType a union {...}.
384         // Check a.b 43 int.
385         // Check a.d 9.1245819012494841e-313 double.
386         // Check a.f 2.80259693e-45 float.
387         // Check a.i 2 int.
388         // Continue.
389
390         dummyStatement(&a);
391         #endif
392     }
393
394     void testComplexWatchers()
395     {
396         struct S { int a; double b; } s[10];
397         BREAK_HERE;
398         // Expand s and s[0].
399         // CheckType s peekandpoke::S [10].
400         // Continue.
401
402         // Manual: Watcher Context: "Add New Watcher".
403         // Manual: Type    ['s[%d].a' % i for i in range(5)]
404         // Manual: Expand it, continue stepping. This should result in a list
405         // Manual: of five items containing the .a fields of s[0]..s[4].
406         for (int i = 0; i != 10; ++i)
407             s[i].a = i;
408
409         dummyStatement(&s);
410     }
411
412     void testQImageDisplay()
413     {
414         QImage im(QSize(200, 200), QImage::Format_RGB32);
415         im.fill(QColor(200, 10, 30).rgba());
416         QPainter pain;
417         pain.begin(&im);
418         pain.setPen(QPen(Qt::black, 5.0, Qt::SolidLine, Qt::RoundCap));
419         BREAK_HERE;
420         // Check im (200x200) QImage.
421         // CheckType pain QPainter.
422         // Continue.
423
424         pain.drawEllipse(20, 20, 160, 160);
425         BREAK_HERE;
426         // Continue.
427
428         // Manual: Toggle between "Normal" and "Displayed" in L&W Context Menu,
429         // Manual: entry "Display of Type QImage".
430         pain.drawArc(70, 115, 60, 30, 200 * 16, 140 * 16);
431         BREAK_HERE;
432         // Continue.
433
434         pain.setBrush(Qt::black);
435         BREAK_HERE;
436         // Continue.
437
438         pain.drawEllipse(65, 70, 15, 15);
439         BREAK_HERE;
440         // Continue.
441
442         // Manual: Toggle between "Normal" and "Displayed" in L&W Context Menu,
443         // Manual: entry "Display of Type QImage".
444         pain.drawEllipse(120, 70, 15, 15);
445         BREAK_HERE;
446         // Continue.
447
448         pain.end();
449         dummyStatement(&pain);
450     }
451
452     void testPeekAndPoke3()
453     {
454         testAnonymousStructs();
455         testComplexWatchers();
456         testQImageDisplay();
457     }
458
459 } // namespace peekandpoke
460
461
462 namespace anon {
463
464     #ifndef Q_CC_RVCT
465     struct TestAnonymous
466     {
467         union {
468             struct { int i; int b; };
469             struct { float f; };
470             double d;
471         };
472     };
473
474     namespace {
475
476         struct Something
477         {
478             Something() { a = b = 1; }
479
480             void foo()
481             {
482                 a = 42;
483                 b = 43;
484             }
485
486             int a, b;
487         };
488
489     }
490     #endif
491
492     void testAnonymous()
493     {
494     #ifndef Q_CC_RVCT
495         TestAnonymous a;
496         BREAK_HERE;
497         // Expand a a.#1 a.#2.
498         // CheckType a anon::TestAnonymous.
499         // Check a.#1   {...}.
500         // CheckType a.#1.b int.
501         // CheckType a.#1.i int.
502         // CheckType a.#2.f float.
503         // CheckType a.d double.
504         // Continue.
505         a.i = 1;
506         a.i = 2;
507         a.i = 3;
508         Something s;
509         BREAK_HERE;
510         // Expand s.
511         // CheckType s anon::(anonymous namespace)::Something.
512         // Check s.a 1 int.
513         // Check s.b 1 int.
514         // Continue.
515         s.foo();
516         BREAK_HERE;
517         // Expand s.
518         // Check s.a 42 int.
519         // Check s.b 43 int.
520         // Continue.
521         dummyStatement(&a, &s);
522     #endif
523     }
524
525 } // namespace anon
526
527
528 namespace qbytearray {
529
530     void testQByteArray1()
531     {
532         QByteArray ba;
533         BREAK_HERE;
534         // Check ba "" QByteArray.
535         // Continue.
536         ba += "Hello";
537         ba += '"';
538         ba += "World";
539         ba += char(0);
540         ba += 1;
541         ba += 2;
542         BREAK_HERE;
543         // Expand ba.
544         // Check ba "Hello"World" QByteArray.
545         // Check ba.0 72 'H' char.
546         // Check ba.11 0 '\0' char.
547         // Check ba.12 1 char.
548         // Check ba.13 2 char.
549         // Continue.
550         dummyStatement(&ba);
551     }
552
553     void testQByteArray2()
554     {
555         QByteArray ba;
556         for (int i = 256; --i >= 0; )
557             ba.append(char(i));
558         QString s(10000, 'x');
559         std::string ss(10000, 'c');
560         BREAK_HERE;
561         // CheckType ba QByteArray.
562         // Check s "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..." QString.
563         // Check ss "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc..." std::string.
564         // Continue.
565         dummyStatement(&ba, &ss, &s);
566     }
567
568     void testQByteArray3()
569     {
570         const char *str1 = "\356";
571         const char *str2 = "\xee";
572         const char *str3 = "\\ee";
573         QByteArray buf1(str1);
574         QByteArray buf2(str2);
575         QByteArray buf3(str3);
576         BREAK_HERE;
577         // Check buf1 "î" QByteArray.
578         // Check buf2 "î" QByteArray.
579         // Check buf3 "\ee" QByteArray.
580         // CheckType str1 char *.
581         // Continue.
582         dummyStatement(&buf1, &buf2, &buf3);
583     }
584
585     void testQByteArray()
586     {
587         testQByteArray1();
588         testQByteArray2();
589         testQByteArray3();
590     }
591
592 } // namespace qbytearray
593
594
595 namespace catchthrow {
596
597     static void throwit1()
598     {
599         BREAK_HERE;
600         // Continue.
601         // Set a breakpoint on "throw" in the BreakWindow context menu
602         // before stepping further.
603         throw 14;
604     }
605
606     static void throwit()
607     {
608         throwit1();
609     }
610
611     void testCatchThrow()
612     {
613         int gotit = 0;
614         try {
615             throwit();
616         } catch (int what) {
617             gotit = what;
618         }
619         dummyStatement(&gotit);
620     }
621
622 } // namespace catchthrow
623
624
625 namespace qdatetime {
626
627     void testQDate()
628     {
629         QDate date;
630         BREAK_HERE;
631         // Expand date.
632         // CheckType date QDate.
633         // Check date.(ISO) "" QString.
634         // Check date.(Locale) "" QString.
635         // Check date.(SystemLocale) "" QString.
636         // Check date.toString "" QString.
637         // Continue.
638
639         // Step, check display.
640         date = QDate::currentDate();
641         date = date.addDays(5);
642         date = date.addDays(5);
643         dummyStatement(&date);
644     }
645
646     void testQTime()
647     {
648         QTime time;
649         BREAK_HERE;
650         // Expand time.
651         // CheckType time QTime.
652         // Check time.(ISO) "" QString.
653         // Check time.(Locale) "" QString.
654         // Check time.(SystemLocale) "" QString.
655         // Check time.toString "" QString.
656         // Continue.
657
658         // Step, check display.
659         time = QTime::currentTime();
660         time = time.addSecs(5);
661         time = time.addSecs(5);
662         dummyStatement(&time);
663     }
664
665     void testQDateTime()
666     {
667         QDateTime date;
668         BREAK_HERE;
669         // Expand date.
670         // CheckType date QDateTime.
671         // Check date.(ISO) "" QString.
672         // Check date.(Locale) "" QString.
673         // Check date.(SystemLocale) "" QString.
674         // Check date.toString "" QString.
675         // Check date.toUTC  QDateTime.
676         // Continue.
677
678         // Step, check display
679         date = QDateTime::currentDateTime();
680         date = date.addDays(5);
681         date = date.addDays(5);
682         dummyStatement(&date);
683     }
684
685     void testDateTime()
686     {
687         testQDate();
688         testQDateTime();
689         testQTime();
690     }
691
692 } // namespace qdatetime
693
694
695 namespace qdir {
696
697     void testQDir()
698     {
699         QDir dir("/tmp");
700         dir.absolutePath();
701         BREAK_HERE;
702         // Check dir "/tmp" QDir.
703         // Check dir.absolutePath "/tmp" QString.
704         // Check dir.canonicalPath "/tmp" QString.
705         // Continue.
706         dummyStatement(&dir);
707     }
708
709 } // namespace qdir
710
711
712 namespace qfileinfo {
713
714     void testQFileInfo()
715     {
716         QFile file("/tmp/t");
717         file.setObjectName("A QFile instance");
718         QFileInfo fi("/tmp/tt");
719         QString s = fi.absoluteFilePath();
720         BREAK_HERE;
721         // Check fi "/tmp/tt" QFileInfo.
722         // Check file "/tmp/t" QFile.
723         // Check s "/tmp/tt" QString.
724         // Continue.
725         dummyStatement(&file, &s);
726     }
727
728 } // namespace qfileinfo
729
730
731 namespace qhash {
732
733     void testQHash1()
734     {
735         QHash<QString, QList<int> > hash;
736         hash.insert("Hallo", QList<int>());
737         hash.insert("Welt", QList<int>() << 1);
738         hash.insert("!", QList<int>() << 1 << 2);
739         hash.insert("!", QList<int>() << 1 << 2);
740         BREAK_HERE;
741         // Expand hash hash.0 hash.1 hash.1.value hash.2 hash.2.value.
742         // Check hash <3 items> QHash<QString, QList<int>>.
743         // Check hash.0   QHashNode<QString, QList<int>>.
744         // Check hash.0.key "Hallo" QString.
745         // Check hash.0.value <0 items> QList<int>.
746         // Check hash.1   QHashNode<QString, QList<int>>.
747         // Check hash.1.key "Welt" QString.
748         // Check hash.1.value <1 items> QList<int>.
749         // Check hash.1.value.0 1 int.
750         // Check hash.2   QHashNode<QString, QList<int>>.
751         // Check hash.2.key "!" QString.
752         // Check hash.2.value <2 items> QList<int>.
753         // Check hash.2.value.0 1 int.
754         // Check hash.2.value.1 2 int.
755         // Continue.
756         dummyStatement(&hash);
757     }
758
759     void testQHash2()
760     {
761         QHash<int, float> hash;
762         hash[11] = 11.0;
763         hash[22] = 22.0;
764         BREAK_HERE;
765         // Expand hash.
766         // Check hash <2 items> QHash<int, float>.
767         // Check hash.22 22 float.
768         // Check hash.11 11 float.
769         // Continue.
770         dummyStatement(&hash);
771     }
772
773     void testQHash3()
774     {
775         QHash<QString, int> hash;
776         hash["22.0"] = 22.0;
777         hash["123.0"] = 22.0;
778         hash["111111ss111128.0"] = 28.0;
779         hash["11124.0"] = 22.0;
780         hash["1111125.0"] = 22.0;
781         hash["11111126.0"] = 22.0;
782         hash["111111127.0"] = 27.0;
783         hash["111111111128.0"] = 28.0;
784         hash["111111111111111111129.0"] = 29.0;
785         BREAK_HERE;
786         // Expand hash hash.0 hash.8.
787         // Check hash <9 items> QHash<QString, int>.
788         // Check hash.0   QHashNode<QString, int>.
789         // Check hash.0.key "123.0" QString.
790         // Check hash.0.value 22 int.
791         // Check hash.8   QHashNode<QString, int>.
792         // Check hash.8.key "11124.0" QString.
793         // Check hash.8.value 22 int.
794         // Continue.
795         dummyStatement(&hash);
796     }
797
798     void testQHash4()
799     {
800         QHash<QByteArray, float> hash;
801         hash["22.0"] = 22.0;
802         hash["123.0"] = 22.0;
803         hash["111111ss111128.0"] = 28.0;
804         hash["11124.0"] = 22.0;
805         hash["1111125.0"] = 22.0;
806         hash["11111126.0"] = 22.0;
807         hash["111111127.0"] = 27.0;
808         hash["111111111128.0"] = 28.0;
809         hash["111111111111111111129.0"] = 29.0;
810         BREAK_HERE;
811         // Expand hash hash.0 hash.8/
812         // Check hash <9 items> QHash<QByteArray, float>.
813         // Check hash.0   QHashNode<QByteArray, float>.
814         // Check hash.0.key "123.0" QByteArray.
815         // Check hash.0.value 22 float.
816         // Check hash.8   QHashNode<QByteArray, float>.
817         // Check hash.8.key "11124.0" QByteArray.
818         // Check hash.8.value 22 float.
819         // Continue.
820         dummyStatement(&hash);
821     }
822
823     void testQHash5()
824     {
825         QHash<int, QString> hash;
826         hash[22] = "22.0";
827         BREAK_HERE;
828         // Expand hash hash.0.
829         // Check hash <1 items> QHash<int, QString>.
830         // Check hash.0   QHashNode<int, QString>.
831         // Check hash.0.key 22 int.
832         // Check hash.0.value "22.0" QString.
833         // Continue.
834         dummyStatement(&hash);
835     }
836
837     void testQHash6()
838     {
839         QHash<QString, Foo> hash;
840         hash["22.0"] = Foo(22);
841         hash["33.0"] = Foo(33);
842         BREAK_HERE;
843         // Expand hash hash.0 hash.0.value hash.1.
844         // Check hash <2 items> QHash<QString, Foo>.
845         // Check hash.0   QHashNode<QString, Foo>.
846         // Check hash.0.key "22.0" QString.
847         // CheckType hash.0.value Foo.
848         // Check hash.0.value.a 22 int.
849         // Check hash.1   QHashNode<QString, Foo>.
850         // Check hash.1.key "33.0" QString.
851         // CheckType hash.1.value Foo.
852         // Continue.
853         dummyStatement(&hash);
854     }
855
856     void testQHash7()
857     {
858         QObject ob;
859         QHash<QString, QPointer<QObject> > hash;
860         hash.insert("Hallo", QPointer<QObject>(&ob));
861         hash.insert("Welt", QPointer<QObject>(&ob));
862         hash.insert(".", QPointer<QObject>(&ob));
863         BREAK_HERE;
864         // Expand hash hash.0 hash.0.value hash.2.
865         // Check hash <3 items> QHash<QString, QPointer<QObject>>.
866         // Check hash.0   QHashNode<QString, QPointer<QObject>>.
867         // Check hash.0.key "Hallo" QString.
868         // CheckType hash.0.value QPointer<QObject>.
869         // CheckType hash.0.value.o QObject.
870         // Check hash.2   QHashNode<QString, QPointer<QObject>>.
871         // Check hash.2.key "." QString.
872         // CheckType hash.2.value QPointer<QObject>.
873         // Continue.
874         dummyStatement(&hash, &ob);
875     }
876
877     void testQHash()
878     {
879         testQHash1();
880         testQHash2();
881         testQHash3();
882         testQHash4();
883         testQHash5();
884         testQHash6();
885         testQHash7();
886     }
887
888 } // namespace qhash
889
890
891 namespace qhostaddress {
892
893     void testQHostAddress()
894     {
895         QHostAddress ha1(129u * 256u * 256u * 256u + 130u);
896         QHostAddress ha2("127.0.0.1");
897         BREAK_HERE;
898         // Check ha1 129.0.0.130 QHostAddress.
899         // Check ha2 "127.0.0.1" QHostAddress.
900         // Continue.
901         dummyStatement(&ha1, &ha2);
902     }
903
904 } // namespace qhostaddress
905
906
907 namespace painting {
908
909     void testQImage()
910     {
911         // only works with Python dumper
912         QImage im(QSize(200, 200), QImage::Format_RGB32);
913         im.fill(QColor(200, 100, 130).rgba());
914         QPainter pain;
915         pain.begin(&im);
916         BREAK_HERE;
917         // Check im (200x200) QImage.
918         // CheckType pain QPainter.
919         // Continue.
920         // Step.
921         pain.drawLine(2, 2, 130, 130);
922         pain.drawLine(4, 2, 130, 140);
923         pain.drawRect(30, 30, 80, 80);
924         pain.end();
925         dummyStatement(&pain, &im);
926     }
927
928     void testQPixmap()
929     {
930         QImage im(QSize(200, 200), QImage::Format_RGB32);
931         im.fill(QColor(200, 100, 130).rgba());
932         QPainter pain;
933         pain.begin(&im);
934         pain.drawLine(2, 2, 130, 130);
935         pain.end();
936         QPixmap pm = QPixmap::fromImage(im);
937         BREAK_HERE;
938         // Check im (200x200) QImage.
939         // CheckType pain QPainter.
940         // Check pm (200x200) QPixmap.
941         // Continue.
942         dummyStatement(&im, &pm);
943     }
944
945     void testPainting()
946     {
947         testQImage();
948         testQPixmap();
949     }
950
951 } // namespace painting
952
953
954 namespace qlinkedlist {
955
956     void testQLinkedListInt()
957     {
958         QLinkedList<int> list;
959         list.append(101);
960         list.append(102);
961         BREAK_HERE;
962         // Expand list.
963         // Check list <2 items> QLinkedList<int>.
964         // Check list.0 101 int.
965         // Check list.1 102 int.
966         // Continue.
967         dummyStatement(&list);
968     }
969
970     void testQLinkedListUInt()
971     {
972         QLinkedList<uint> list;
973         list.append(103);
974         list.append(104);
975         BREAK_HERE;
976         // Expand list.
977         // Check list <2 items> QLinkedList<unsigned int>.
978         // Check list.0 103 unsigned int.
979         // Check list.1 104 unsigned int.
980         // Continue.
981         dummyStatement(&list);
982     }
983
984     void testQLinkedListFooStar()
985     {
986         QLinkedList<Foo *> list;
987         list.append(new Foo(1));
988         list.append(0);
989         list.append(new Foo(3));
990         BREAK_HERE;
991         // Expand list list.0 list.2.
992         // Check list <3 items> QLinkedList<Foo*>.
993         // CheckType list.0 Foo.
994         // Check list.0.a 1 int.
995         // Check list.1 0x0 Foo *.
996         // CheckType list.2 Foo.
997         // Check list.2.a 3 int.
998         // Continue.
999         dummyStatement(&list);
1000     }
1001
1002     void testQLinkedListULongLong()
1003     {
1004         QLinkedList<qulonglong> list;
1005         list.append(42);
1006         list.append(43);
1007         BREAK_HERE;
1008         // Expand list.
1009         // Check list <2 items> QLinkedList<unsigned long long>.
1010         // Check list.0 42 unsigned long long.
1011         // Check list.1 43 unsigned long long.
1012         // Continue.
1013         dummyStatement(&list);
1014     }
1015
1016     void testQLinkedListFoo()
1017     {
1018         QLinkedList<Foo> list;
1019         list.append(Foo(1));
1020         list.append(Foo(2));
1021         BREAK_HERE;
1022         // Expand list list.0 list.1.
1023         // Check list <2 items> QLinkedList<Foo>.
1024         // CheckType list.0 Foo.
1025         // Check list.0.a 1 int.
1026         // CheckType list.1 Foo.
1027         // Check list.1.a 2 int.
1028         // Continue.
1029         dummyStatement(&list);
1030     }
1031
1032     void testQLinkedListStdString()
1033     {
1034         QLinkedList<std::string> list;
1035         list.push_back("aa");
1036         list.push_back("bb");
1037         BREAK_HERE;
1038         // Expand list.
1039         // Check list <2 items> QLinkedList<std::string>.
1040         // Check list.0 "aa" std::string.
1041         // Check list.1 "bb" std::string.
1042         // Continue.
1043         dummyStatement(&list);
1044     }
1045
1046     void testQLinkedList()
1047     {
1048         testQLinkedListInt();
1049         testQLinkedListUInt();
1050         testQLinkedListFooStar();
1051         testQLinkedListULongLong();
1052         testQLinkedListFoo();
1053         testQLinkedListStdString();
1054     }
1055
1056 } // namespace qlinkedlist
1057
1058
1059 namespace qlist {
1060
1061     void testQListInt()
1062     {
1063         QList<int> big;
1064         for (int i = 0; i < 10000; ++i)
1065             big.push_back(i);
1066         BREAK_HERE;
1067         // Expand big.
1068         // Check big <10000 items> QList<int>.
1069         // Check big.0 0 int.
1070         // Check big.1999 1999 int.
1071         // Continue.
1072         dummyStatement(&big);
1073     }
1074
1075     void testQListIntStar()
1076     {
1077         QList<int *> l;
1078         BREAK_HERE;
1079         // Check l <0 items> QList<int*>.
1080         // Continue.
1081         l.append(new int(1));
1082         l.append(new int(2));
1083         l.append(new int(3));
1084         BREAK_HERE;
1085         // Expand l.
1086         // Check l <3 items> QList<int*>.
1087         // CheckType l.0 int.
1088         // CheckType l.2 int.
1089         // Continue.
1090         dummyStatement(&l);
1091     }
1092
1093     void testQListUInt()
1094     {
1095         QList<uint> l;
1096         BREAK_HERE;
1097         // Check l <0 items> QList<unsigned int>.
1098         // Continue.
1099         l.append(101);
1100         l.append(102);
1101         l.append(102);
1102         BREAK_HERE;
1103         // Expand l.
1104         // Check l <3 items> QList<unsigned int>.
1105         // Check l.0 101 unsigned int.
1106         // Check l.2 102 unsigned int.
1107         // Continue.
1108         dummyStatement(&l);
1109     }
1110
1111     void testQListUShort()
1112     {
1113         QList<ushort> l;
1114         BREAK_HERE;
1115         // Check l <0 items> QList<unsigned short>.
1116         // Continue.
1117         l.append(101);
1118         l.append(102);
1119         l.append(102);
1120         BREAK_HERE;
1121         // Expand l.
1122         // Check l <3 items> QList<unsigned short>.
1123         // Check l.0 101 unsigned short.
1124         // Check l.2 102 unsigned short.
1125         // Continue.
1126         dummyStatement(&l);
1127     }
1128
1129     void testQListQChar()
1130     {
1131         QList<QChar> l;
1132         BREAK_HERE;
1133         // Check l <0 items> QList<QChar>.
1134         // Continue.
1135         l.append(QChar('a'));
1136         l.append(QChar('b'));
1137         l.append(QChar('c'));
1138         BREAK_HERE;
1139         // Expand l.
1140         // Check l <3 items> QList<QChar>.
1141         // Check l.0 'a' (97) QChar.
1142         // Check l.2 'c' (99) QChar.
1143         // Continue.
1144         dummyStatement(&l);
1145     }
1146
1147     void testQListQULongLong()
1148     {
1149         QList<qulonglong> l;
1150         BREAK_HERE;
1151         // Check l <0 items> QList<unsigned long long>.
1152         // Continue.
1153         l.append(101);
1154         l.append(102);
1155         l.append(102);
1156         BREAK_HERE;
1157         // Expand l.
1158         // Check l <3 items> QList<unsigned long long>.
1159         // CheckType l.0 unsigned long long.
1160         // CheckType l.2 unsigned long long.
1161         // Continue.
1162         dummyStatement(&l);
1163     }
1164
1165     void testQListStdString()
1166     {
1167         QList<std::string> l;
1168         BREAK_HERE;
1169         // Check l <0 items> QList<std::string>.
1170         // Continue.
1171         l.push_back("aa");
1172         l.push_back("bb");
1173         l.push_back("cc");
1174         l.push_back("dd");
1175         BREAK_HERE;
1176         // Expand l.
1177         // Check l <4 items> QList<std::string>.
1178         // CheckType l.0 std::string.
1179         // CheckType l.3 std::string.
1180         // Continue.
1181         dummyStatement(&l);
1182     }
1183
1184     void testQListFoo()
1185     {
1186         QList<Foo> l;
1187         BREAK_HERE;
1188         // Check l <0 items> QList<Foo>.
1189         // Continue.
1190         for (int i = 0; i < 100; ++i)
1191             l.push_back(i + 15);
1192         BREAK_HERE;
1193         // Check l <100 items> QList<Foo>.
1194         // Expand l.
1195         // CheckType l.0 Foo.
1196         // CheckType l.99 Foo.
1197         // Continue.
1198         l.push_back(1000);
1199         l.push_back(1001);
1200         l.push_back(1002);
1201         BREAK_HERE;
1202         // Check l <103 items> QList<Foo>.
1203         // Continue.
1204         dummyStatement(&l);
1205     }
1206
1207     void testQListReverse()
1208     {
1209         QList<int> l = QList<int>() << 1 << 2 << 3;
1210         typedef std::reverse_iterator<QList<int>::iterator> Reverse;
1211         Reverse rit(l.end());
1212         Reverse rend(l.begin());
1213         QList<int> r;
1214         while (rit != rend)
1215             r.append(*rit++);
1216         BREAK_HERE;
1217         // Expand l r.
1218         // Check l <3 items> QList<int>.
1219         // Check l.0 1 int.
1220         // Check l.1 2 int.
1221         // Check l.2 3 int.
1222         // Check r <3 items> QList<int>.
1223         // Check r.0 3 int.
1224         // Check r.1 2 int.
1225         // Check r.2 1 int.
1226         // CheckType rend qlist::Reverse.
1227         // CheckType rit qlist::Reverse.
1228         // Continue.
1229         dummyStatement();
1230     }
1231
1232     void testQList()
1233     {
1234         testQListInt();
1235         testQListIntStar();
1236         testQListUInt();
1237         testQListUShort();
1238         testQListQChar();
1239         testQListQULongLong();
1240         testQListStdString();
1241         testQListFoo();
1242         testQListReverse();
1243     }
1244
1245 } // namespace qlist
1246
1247
1248 namespace qlocale {
1249
1250     void testQLocale()
1251     {
1252         QLocale loc = QLocale::system();
1253         //QString s = loc.name();
1254         //QVariant v = loc;
1255         QLocale::MeasurementSystem m = loc.measurementSystem();
1256         BREAK_HERE;
1257         // CheckType loc QLocale.
1258         // CheckType m QLocale::MeasurementSystem.
1259         // Continue.
1260         dummyStatement(&loc, &m);
1261     }
1262
1263 } // namespace qlocale
1264
1265
1266 namespace qmap {
1267
1268     void testQMapUIntStringList()
1269     {
1270         QMap<uint, QStringList> map;
1271         map[11] = QStringList() << "11";
1272         map[22] = QStringList() << "22";
1273         BREAK_HERE;
1274         // Expand map map.0 map.0.value map.1 map.1.value.
1275         // Check map <2 items> QMap<unsigned int, QStringList>.
1276         // Check map.0   QMapNode<unsigned int, QStringList>.
1277         // Check map.0.key 11 unsigned int.
1278         // Check map.0.value <1 items> QStringList.
1279         // Check map.0.value.0 "11" QString.
1280         // Check map.1   QMapNode<unsigned int, QStringList>.
1281         // Check map.1.key 22 unsigned int.
1282         // Check map.1.value <1 items> QStringList.
1283         // Check map.1.value.0 "22" QString.
1284         // Continue.
1285         dummyStatement(&map);
1286     }
1287
1288     void testQMapUIntStringListTypedef()
1289     {
1290         // only works with Python dumper
1291         typedef QMap<uint, QStringList> T;
1292         T map;
1293         map[11] = QStringList() << "11";
1294         map[22] = QStringList() << "22";
1295         BREAK_HERE;
1296         // Check map <2 items> qmap::T.
1297         // Continue.
1298         dummyStatement(&map);
1299     }
1300
1301     void testQMapUIntFloat()
1302     {
1303         QMap<uint, float> map;
1304         map[11] = 11.0;
1305         map[22] = 22.0;
1306         BREAK_HERE;
1307         // Expand map.
1308         // Check map <2 items> QMap<unsigned int, float>.
1309         // Check map.11 11 float.
1310         // Check map.22 22 float.
1311         // Continue.
1312         dummyStatement(&map);
1313     }
1314
1315     void testQMapStringFloat()
1316     {
1317         QMap<QString, float> map;
1318         map["22.0"] = 22.0;
1319         BREAK_HERE;
1320         // Expand map map.0.
1321         // Check map <1 items> QMap<QString, float>.
1322         // Check map.0   QMapNode<QString, float>.
1323         // Check map.0.key "22.0" QString.
1324         // Check map.0.value 22 float.
1325         // Continue.
1326         dummyStatement(&map);
1327     }
1328
1329     void testQMapIntString()
1330     {
1331         QMap<int, QString> map;
1332         map[22] = "22.0";
1333         BREAK_HERE;
1334         // Expand map map.0.
1335         // Check map <1 items> QMap<int, QString>.
1336         // Check map.0   QMapNode<int, QString>.
1337         // Check map.0.key 22 int.
1338         // Check map.0.value "22.0" QString.
1339         // Continue.
1340         dummyStatement(&map);
1341     }
1342
1343     void testQMapStringFoo()
1344     {
1345         QMap<QString, Foo> map;
1346         map["22.0"] = Foo(22);
1347         map["33.0"] = Foo(33);
1348         BREAK_HERE;
1349         // Expand map map.0 map.0.key map.0.value map.1 map.1.value.
1350         // Check map <2 items> QMap<QString, Foo>.
1351         // Check map.0   QMapNode<QString, Foo>.
1352         // Check map.0.key "22.0" QString.
1353         // CheckType map.0.value Foo.
1354         // Check map.0.value.a 22 int.
1355         // Check map.1   QMapNode<QString, Foo>.
1356         // Check map.1.key "33.0" QString.
1357         // CheckType map.1.value Foo.
1358         // Check map.1.value.a 33 int.
1359         // Continue.
1360         dummyStatement(&map);
1361     }
1362
1363     void testQMapStringPointer()
1364     {
1365         // only works with Python dumper
1366         QObject ob;
1367         QMap<QString, QPointer<QObject> > map;
1368         map.insert("Hallo", QPointer<QObject>(&ob));
1369         map.insert("Welt", QPointer<QObject>(&ob));
1370         map.insert(".", QPointer<QObject>(&ob));
1371         BREAK_HERE;
1372         // Expand map map.0 map.0.key map.0.value map.1 map.2.
1373         // Check map <3 items> QMap<QString, QPointer<QObject>>.
1374         // Check map.0   QMapNode<QString, QPointer<QObject>>.
1375         // Check map.0.key "." QString.
1376         // CheckType map.0.value QPointer<QObject>.
1377         // CheckType map.0.value.o QObject.
1378         // Check map.1   QMapNode<QString, QPointer<QObject>>.
1379         // Check map.1.key "Hallo" QString.
1380         // Check map.2   QMapNode<QString, QPointer<QObject>>.
1381         // Check map.2.key "Welt" QString.
1382         // Continue.
1383         dummyStatement(&map);
1384     }
1385
1386     void testQMapStringList()
1387     {
1388         // only works with Python dumper
1389         QList<nsA::nsB::SomeType *> x;
1390         x.append(new nsA::nsB::SomeType(1));
1391         x.append(new nsA::nsB::SomeType(2));
1392         x.append(new nsA::nsB::SomeType(3));
1393         QMap<QString, QList<nsA::nsB::SomeType *> > map;
1394         map["foo"] = x;
1395         map["bar"] = x;
1396         map["1"] = x;
1397         map["2"] = x;
1398         BREAK_HERE;
1399         // Expand map map.0 map.0.key map.0.value map.1 map.1.value.1 map.1.value.2 map.3 map.3.value map.3.value.2.
1400         // Check map <4 items> QMap<QString, QList<nsA::nsB::SomeType*>>.
1401         // Check map.0   QMapNode<QString, QList<nsA::nsB::SomeType*>>.
1402         // Check map.0.key "1" QString.
1403         // Check map.0.value <3 items> QList<nsA::nsB::SomeType*>.
1404         // CheckType map.0.value.0 nsA::nsB::SomeType.
1405         // Check map.0.value.0.a 1 int.
1406         // CheckType map.0.value.1 nsA::nsB::SomeType.
1407         // Check map.0.value.1.a 2 int.
1408         // CheckType map.0.value.2 nsA::nsB::SomeType.
1409         // Check map.0.value.2.a 3 int.
1410         // Check map.3   QMapNode<QString, QList<nsA::nsB::SomeType*>>.
1411         // Check map.3.key "foo" QString.
1412         // Check map.3.value <3 items> QList<nsA::nsB::SomeType*>.
1413         // CheckType map.3.value.2 nsA::nsB::SomeType.
1414         // Check map.3.value.2.a 3 int.
1415         // Check x <3 items> QList<nsA::nsB::SomeType*>.
1416         // Continue.
1417         dummyStatement(&map);
1418     }
1419
1420     void testQMultiMapUintFloat()
1421     {
1422         QMultiMap<uint, float> map;
1423         map.insert(11, 11.0);
1424         map.insert(22, 22.0);
1425         map.insert(22, 33.0);
1426         map.insert(22, 34.0);
1427         map.insert(22, 35.0);
1428         map.insert(22, 36.0);
1429         BREAK_HERE;
1430         // Expand map.
1431         // Check map <6 items> QMultiMap<unsigned int, float>.
1432         // Check map.0 11 float.
1433         // Check map.5 22 float.
1434         // Continue.
1435         dummyStatement(&map);
1436     }
1437
1438     void testQMultiMapStringFloat()
1439     {
1440         QMultiMap<QString, float> map;
1441         map.insert("22.0", 22.0);
1442         BREAK_HERE;
1443         // Expand map map.0.
1444         // Check map <1 items> QMultiMap<QString, float>.
1445         // Check map.0   QMapNode<QString, float>.
1446         // Check map.0.key "22.0" QString.
1447         // Check map.0.value 22 float.
1448         // Continue.
1449         dummyStatement(&map);
1450     }
1451
1452     void testQMultiMapIntString()
1453     {
1454         QMultiMap<int, QString> map;
1455         map.insert(22, "22.0");
1456         BREAK_HERE;
1457         // Expand map map.0.
1458         // Check map <1 items> QMultiMap<int, QString>.
1459         // Check map.0   QMapNode<int, QString>.
1460         // Check map.0.key 22 int.
1461         // Check map.0.value "22.0" QString.
1462         // Continue.
1463         dummyStatement(&map);
1464     }
1465
1466     void testQMultiMapStringFoo()
1467     {
1468         QMultiMap<QString, Foo> map;
1469         map.insert("22.0", Foo(22));
1470         map.insert("33.0", Foo(33));
1471         map.insert("22.0", Foo(22));
1472         BREAK_HERE;
1473         // Expand map map.0 map.0.value.
1474         // Check map <3 items> QMultiMap<QString, Foo>.
1475         // Check map.0   QMapNode<QString, Foo>.
1476         // Check map.0.key "22.0" QString.
1477         // CheckType map.0.value Foo.
1478         // Check map.0.value.a 22 int.
1479         // Check map.2   QMapNode<QString, Foo>.
1480         // Continue.
1481         dummyStatement(&map);
1482     }
1483
1484     void testQMultiMapStringPointer()
1485     {
1486         QObject ob;
1487         QMultiMap<QString, QPointer<QObject> > map;
1488         map.insert("Hallo", QPointer<QObject>(&ob));
1489         map.insert("Welt", QPointer<QObject>(&ob));
1490         map.insert(".", QPointer<QObject>(&ob));
1491         map.insert(".", QPointer<QObject>(&ob));
1492         BREAK_HERE;
1493         // Expand map map.0 map.1 map.2 map.3.
1494         // Check map <4 items> QMultiMap<QString, QPointer<QObject>>.
1495         // Check map.0   QMapNode<QString, QPointer<QObject>>.
1496         // Check map.0.key "." QString.
1497         // CheckType map.0.value QPointer<QObject>.
1498         // Check map.1   QMapNode<QString, QPointer<QObject>>.
1499         // Check map.1.key "." QString.
1500         // Check map.2   QMapNode<QString, QPointer<QObject>>.
1501         // Check map.2.key "Hallo" QString.
1502         // Check map.3   QMapNode<QString, QPointer<QObject>>.
1503         // Check map.3.key "Welt" QString.
1504         // Continue.
1505         dummyStatement(&map);
1506     }
1507
1508     void testQMap()
1509     {
1510         testQMapUIntStringList();
1511         testQMapUIntStringListTypedef();
1512         testQMapUIntFloat();
1513         testQMapStringFloat();
1514         testQMapIntString();
1515         testQMapStringFoo();
1516         testQMapStringPointer();
1517         testQMapStringList();
1518         testQMultiMapUintFloat();
1519         testQMultiMapStringFloat();
1520         testQMultiMapIntString();
1521         testQMultiMapStringFoo();
1522         testQMapUIntStringList();
1523         testQMultiMapStringFoo();
1524         testQMultiMapStringPointer();
1525     }
1526
1527 } // namespace qmap
1528
1529
1530 namespace qobject {
1531
1532     void testQObject1()
1533     {
1534         // This checks whether signal-slot connections are displayed.
1535         QObject parent;
1536         parent.setObjectName("A Parent");
1537         QObject child(&parent);
1538         child.setObjectName("A Child");
1539         QObject::connect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));
1540         QObject::disconnect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));
1541         child.setObjectName("A renamed Child");
1542         BREAK_HERE;
1543         // Check child "A renamed Child" QObject.
1544         // Check parent "A Parent" QObject.
1545         // Continue.
1546         dummyStatement(&parent, &child);
1547     }
1548
1549     namespace Names {
1550         namespace Bar {
1551
1552         struct Ui { Ui() { w = 0; } QWidget *w; };
1553
1554         class TestObject : public QObject
1555         {
1556             Q_OBJECT
1557         public:
1558             TestObject(QObject *parent = 0) : QObject(parent)
1559                 { m_ui = new Ui; m_ui->w = new QWidget; }
1560
1561             Q_PROPERTY(QString myProp1 READ myProp1 WRITE setMyProp1)
1562             QString myProp1() const { return m_myProp1; }
1563             Q_SLOT void setMyProp1(const QString&mt) { m_myProp1 = mt; }
1564
1565             Q_PROPERTY(QString myProp2 READ myProp2 WRITE setMyProp2)
1566             QString myProp2() const { return m_myProp2; }
1567             Q_SLOT void setMyProp2(const QString&mt) { m_myProp2 = mt; }
1568
1569         public:
1570             Ui *m_ui;
1571             QString m_myProp1;
1572             QString m_myProp2;
1573         };
1574
1575         } // namespace Bar
1576     } // namespace Names
1577
1578     void testQObject2()
1579     {
1580         //QString longString = QString(10000, QLatin1Char('A'));
1581     #if 1
1582         Names::Bar::TestObject test;
1583         test.setMyProp1("HELLO");
1584         test.setMyProp2("WORLD");
1585         QString s = test.myProp1();
1586         s += test.myProp2();
1587         BREAK_HERE;
1588         // Check s "HELLOWORLD" QString.
1589         // Check test "" qobject::Names::Bar::TestObject.
1590         // Continue.
1591         dummyStatement(&s);
1592     #endif
1593
1594     #if 0
1595         QAction act("xxx", &app);
1596         QString t = act.text();
1597         t += "y";
1598         t += "y";
1599         t += "y";
1600         t += "y";
1601         t += "y";
1602     #endif
1603
1604     #if 1
1605         QWidget ob;
1606         ob.setObjectName("An Object");
1607         ob.setProperty("USER DEFINED 1", 44);
1608         ob.setProperty("USER DEFINED 2", QStringList() << "FOO" << "BAR");
1609         QObject ob1;
1610         ob1.setObjectName("Another Object");
1611
1612         QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
1613         QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
1614         //QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater()));
1615     #endif
1616
1617     #if 0
1618         QList<QObject *> obs;
1619         obs.append(&ob);
1620         obs.append(&ob1);
1621         obs.append(0);
1622         obs.append(&app);
1623         ob1.setObjectName("A Subobject");
1624     #endif
1625     }
1626
1627     class Sender : public QObject
1628     {
1629         Q_OBJECT
1630     public:
1631         Sender() { setObjectName("Sender"); }
1632         void doEmit() { emit aSignal(); }
1633     signals:
1634         void aSignal();
1635     };
1636
1637     class Receiver : public QObject
1638     {
1639         Q_OBJECT
1640     public:
1641         Receiver() { setObjectName("Receiver"); }
1642     public slots:
1643         void aSlot() {
1644             QObject *s = sender();
1645             if (s) {
1646                 qDebug() << "SENDER: " << s;
1647             } else {
1648                 qDebug() << "NO SENDER";
1649             }
1650         }
1651     };
1652
1653     void testSignalSlot()
1654     {
1655         Sender sender;
1656         Receiver receiver;
1657         QObject::connect(&sender, SIGNAL(aSignal()), &receiver, SLOT(aSlot()));
1658         // Break here.
1659         // Single step through signal emission.
1660         sender.doEmit();
1661         dummyStatement(&sender, &receiver);
1662     }
1663
1664     #if USE_PRIVATE
1665
1666     class DerivedObjectPrivate : public QObjectPrivate
1667     {
1668     public:
1669         DerivedObjectPrivate() {
1670             m_extraX = 43;
1671             m_extraY.append("xxx");
1672             m_extraZ = 1;
1673         }
1674         int m_extraX;
1675         QStringList m_extraY;
1676         uint m_extraZ : 1;
1677         bool m_extraA : 1;
1678         bool m_extraB;
1679     };
1680
1681     class DerivedObject : public QObject
1682     {
1683         Q_OBJECT
1684
1685     public:
1686         DerivedObject() : QObject(*new DerivedObjectPrivate, 0) {}
1687
1688         Q_PROPERTY(int x READ x WRITE setX)
1689         Q_PROPERTY(QStringList y READ y WRITE setY)
1690         Q_PROPERTY(uint z READ z WRITE setZ)
1691
1692         int x() const;
1693         void setX(int x);
1694         QStringList y() const;
1695         void setY(QStringList y);
1696         uint z() const;
1697         void setZ(uint z);
1698
1699     private:
1700         Q_DECLARE_PRIVATE(DerivedObject)
1701     };
1702
1703     int DerivedObject::x() const
1704     {
1705         Q_D(const DerivedObject);
1706         return d->m_extraX;
1707     }
1708
1709     void DerivedObject::setX(int x)
1710     {
1711         Q_D(DerivedObject);
1712         d->m_extraX = x;
1713         d->m_extraA = !d->m_extraA;
1714         d->m_extraB = !d->m_extraB;
1715     }
1716
1717     QStringList DerivedObject::y() const
1718     {
1719         Q_D(const DerivedObject);
1720         return d->m_extraY;
1721     }
1722
1723     void DerivedObject::setY(QStringList y)
1724     {
1725         Q_D(DerivedObject);
1726         d->m_extraY = y;
1727     }
1728
1729     uint DerivedObject::z() const
1730     {
1731         Q_D(const DerivedObject);
1732         return d->m_extraZ;
1733     }
1734
1735     void DerivedObject::setZ(uint z)
1736     {
1737         Q_D(DerivedObject);
1738         d->m_extraZ = z;
1739     }
1740
1741     #endif
1742
1743     void testQObjectData()
1744     {
1745         // This checks whether QObject-derived classes with Q_PROPERTYs
1746         // are displayed properly.
1747     #if USE_PRIVATE
1748         DerivedObject ob;
1749         BREAK_HERE;
1750         // Expand ob ob.properties.
1751         // Check ob.properties.x 43 QVariant (int).
1752         // Continue.
1753
1754         // expand ob and ob.properties
1755         // step, and check whether x gets updated.
1756         ob.setX(23);
1757         ob.setX(25);
1758         ob.setX(26);
1759         BREAK_HERE;
1760         // Expand ob ob.properties.
1761         // Check ob.properties.x 26 QVariant (int).
1762         // Continue.
1763     #endif
1764     }
1765
1766     void testQObject()
1767     {
1768         testQObjectData();
1769         testQObject1();
1770         testQObject2();
1771         testSignalSlot();
1772     }
1773
1774 } // namespace qobject
1775
1776
1777
1778 namespace qregexp {
1779
1780     void testQRegExp()
1781     {
1782         // Works with Python dumpers only.
1783         QRegExp re(QString("a(.*)b(.*)c"));
1784         BREAK_HERE;
1785         // Check re "a(.*)b(.*)c" QRegExp.
1786         // Continue.
1787         QString str1 = "a1121b344c";
1788         QString str2 = "Xa1121b344c";
1789         BREAK_HERE;
1790         // Check str1 "a1121b344c" QString.
1791         // Check str2 "Xa1121b344c" QString.
1792         // Continue.
1793         int pos2 = re.indexIn(str2);
1794         int pos1 = re.indexIn(str1);
1795         BREAK_HERE;
1796         // Check pos1 0 int.
1797         // Check pos2 1 int.
1798         // Continue.
1799         dummyStatement(&pos1, &pos2);
1800     }
1801
1802 } // namespace qregexp
1803
1804
1805 namespace qrect {
1806
1807     void testQPoint()
1808     {
1809         QPoint s;
1810         BREAK_HERE;
1811         // Check s (0, 0) QPoint.
1812         // Continue.
1813         // Step over, check display looks sane.
1814         s = QPoint(100, 200);
1815         BREAK_HERE;
1816         // Check s (100, 200) QPoint.
1817         // Continue.
1818         dummyStatement(&s);
1819     }
1820
1821     void testQPointF()
1822     {
1823         QPointF s;
1824         BREAK_HERE;
1825         // Check s (0, 0) QPointF.
1826         // Continue.
1827         // Step over, check display looks sane.
1828         s = QPointF(100, 200);
1829         BREAK_HERE;
1830         // Check s (100, 200) QPointF.
1831         // Continue.
1832         dummyStatement(&s);
1833     }
1834
1835     void testQRect()
1836     {
1837         QRect rect;
1838         BREAK_HERE;
1839         // Check rect 0x0+0+0 QRect.
1840         // Continue.
1841         // Step over, check display looks sane.
1842         rect = QRect(100, 100, 200, 200);
1843         BREAK_HERE;
1844         // Check rect 200x200+100+100 QRect.
1845         // Continue.
1846         dummyStatement(&rect);
1847     }
1848
1849     void testQRectF()
1850     {
1851         QRectF rect;
1852         BREAK_HERE;
1853         // Check rect 0x0+0+0 QRectF.
1854         // Continue.
1855         // Step over, check display looks sane.
1856         rect = QRectF(100, 100, 200, 200);
1857         BREAK_HERE;
1858         // Check rect 200x200+100+100 QRectF.
1859         // Continue.
1860         dummyStatement(&rect);
1861     }
1862
1863     void testQSize()
1864     {
1865         QSize s;
1866         BREAK_HERE;
1867         // Check s (-1, -1) QSize.
1868         // Continue.
1869         s = QSize(100, 200);
1870         BREAK_HERE;
1871         // Check s (100, 200) QSize.
1872         // Continue.
1873         dummyStatement(&s);
1874     }
1875
1876     void testQSizeF()
1877     {
1878         QSizeF s;
1879         BREAK_HERE;
1880         // Check s (-1, -1) QSizeF.
1881         // Continue.
1882         s = QSizeF(100, 200);
1883         BREAK_HERE;
1884         // Check s (100, 200) QSizeF.
1885         // Continue.
1886         dummyStatement(&s);
1887     }
1888
1889     void testGeometry()
1890     {
1891         testQPoint();
1892         testQPointF();
1893         testQRect();
1894         testQRectF();
1895         testQSize();
1896         testQSizeF();
1897     }
1898
1899 } // namespace qrect
1900
1901
1902 namespace qregion {
1903
1904     void testQRegion()
1905     {
1906         // Works with Python dumpers only.
1907         QRegion region;
1908         BREAK_HERE;
1909         // Check region <empty> QRegion.
1910         // Continue.
1911         // Step over until end, check display looks sane.
1912         region += QRect(100, 100, 200, 200);
1913         BREAK_HERE;
1914         // Expand region.
1915         // Check region <1 items> QRegion.
1916         // CheckType region.extents QRect.
1917         // Check region.innerArea 40000 int.
1918         // CheckType region.innerRect QRect.
1919         // Check region.numRects 1 int.
1920         // Check region.rects <0 items> QVector<QRect>.
1921         // Continue.
1922         region += QRect(300, 300, 400, 500);
1923         BREAK_HERE;
1924         // Expand region.
1925         // Check region <2 items> QRegion.
1926         // CheckType region.extents QRect.
1927         // Check region.innerArea 200000 int.
1928         // CheckType region.innerRect QRect.
1929         // Check region.numRects 2 int.
1930         // Check region.rects <2 items> QVector<QRect>.
1931         // Continue.
1932         region += QRect(500, 500, 600, 600);
1933         BREAK_HERE;
1934         // Expand region.
1935         // Check region <4 items> QRegion.
1936         // CheckType region.extents QRect.
1937         // Check region.innerArea 360000 int.
1938         // CheckType region.innerRect QRect.
1939         // Check region.numRects 4 int.
1940         // Check region.rects <8 items> QVector<QRect>.
1941         // Continue.
1942         region += QRect(500, 500, 600, 600);
1943         BREAK_HERE;
1944         // Check region <4 items> QRegion.
1945         // Continue.
1946         region += QRect(500, 500, 600, 600);
1947         BREAK_HERE;
1948         // Check region <4 items> QRegion.
1949         // Continue.
1950         region += QRect(500, 500, 600, 600);
1951         BREAK_HERE;
1952         // Check region <4 items> QRegion.
1953         // Continue.
1954         dummyStatement(&region);
1955     }
1956
1957 } // namespace qregion
1958
1959
1960 namespace plugin {
1961
1962     void testPlugin()
1963     {
1964         QString dir = QDir::currentPath();
1965     #ifdef Q_OS_LINUX
1966         QLibrary lib(dir + "/libsimple_test_plugin.so");
1967     #endif
1968     #ifdef Q_OS_MAC
1969         dir = QFileInfo(dir + "/../..").canonicalPath();
1970         QLibrary lib(dir + "/libsimple_test_plugin.dylib");
1971     #endif
1972     #ifdef Q_OS_WIN
1973         QLibrary lib(dir + "/debug/simple_test_plugin.dll");
1974     #endif
1975     #ifdef Q_OS_SYMBIAN
1976         QLibrary lib(dir + "/libsimple_test_plugin.dll");
1977     #endif
1978         BREAK_HERE;
1979         // CheckType dir QString.
1980         // Check lib "" QLibrary.
1981         // Check name <not accessible> QString.
1982         // CheckType res int.
1983         // Continue.
1984         // Step
1985         int (*foo)() = (int(*)()) lib.resolve("pluginTest");
1986         QString name = lib.fileName();
1987         int res = 4;
1988         if (foo) {
1989             BREAK_HERE;
1990             // Check res 4 int.
1991             // Continue.
1992             // Step
1993             res = foo();
1994         } else {
1995             BREAK_HERE;
1996             // Step
1997             name = lib.errorString();
1998         }
1999         dummyStatement(&name, &res);
2000     }
2001
2002 } // namespace plugin
2003
2004
2005 namespace final {
2006
2007     void testQSettings()
2008     {
2009         // Note: Construct a QCoreApplication first.
2010         QSettings settings("/tmp/test.ini", QSettings::IniFormat);
2011         QVariant value = settings.value("item1","").toString();
2012         BREAK_HERE;
2013         // Expand settings.
2014         // Check settings "" QSettings.
2015         // Check settings.@1 "" QObject.
2016         // Check value "" QVariant (QString).
2017         // Continue.
2018         dummyStatement(&settings, &value);
2019     }
2020
2021     void testNullPointerDeref()
2022     {
2023         BREAK_HERE;
2024         // Continue.
2025
2026         return; // Uncomment.
2027         *(int *)0 = 0;
2028     }
2029
2030     void testEndlessRecursion()
2031     {
2032         BREAK_HERE;
2033         // Continue.
2034
2035         return; // Uncomment.
2036         testEndlessRecursion();
2037     }
2038
2039     void testEndlessLoop()
2040     {
2041         qlonglong a = 1;
2042         // gdb:
2043         // Breakpoint at "while" will stop only once
2044         // Hitting "Pause" button might show backtrace of different thread
2045         BREAK_HERE;
2046         // Continue.
2047
2048         // Jump over next line.
2049         return;
2050         while (a > 0)
2051             ++a;
2052         dummyStatement(&a);
2053     }
2054
2055     void testUncaughtException()
2056     {
2057         BREAK_HERE;
2058         // Continue.
2059
2060         // Jump over next line.
2061         return;
2062         throw 42;
2063     }
2064
2065     void testApplicationStart(QCoreApplication *app)
2066     {
2067         QString str = QString::fromUtf8("XXXXXXXXXXXXXXyyXXX ö");
2068         QLabel l(str);
2069         l.setObjectName("Some Label");
2070         l.show();
2071         // Jump over next line.
2072         return;
2073         app->exec();
2074         dummyStatement(&app);
2075     }
2076
2077     void testFinal(QCoreApplication *app)
2078     {
2079         // This contains all "final" tests that do not allow proceeding
2080         // with further tests.
2081         BREAK_HERE;
2082         // Continue.
2083         testQSettings();
2084         testNullPointerDeref();
2085         testEndlessLoop();
2086         testEndlessRecursion();
2087         testUncaughtException();
2088         testApplicationStart(app);
2089     }
2090
2091 } // namespace final
2092
2093
2094 namespace qset {
2095
2096     void testQSet1()
2097     {
2098         QSet<int> s;
2099         s.insert(11);
2100         s.insert(22);
2101         BREAK_HERE;
2102         // Expand s.
2103         // Check s <2 items> QSet<int>.
2104         // Check s.22 22 int.
2105         // Check s.11 11 int.
2106         // Continue.
2107         dummyStatement(&s);
2108     }
2109
2110     void testQSet2()
2111     {
2112         QSet<QString> s;
2113         s.insert("11.0");
2114         s.insert("22.0");
2115         BREAK_HERE;
2116         // Expand s.
2117         // Check s <2 items> QSet<QString>.
2118         // Check s.0 "11.0" QString.
2119         // Check s.1 "22.0" QString.
2120         // Continue.
2121         dummyStatement(&s);
2122     }
2123
2124     void testQSet3()
2125     {
2126         QObject ob;
2127         QSet<QPointer<QObject> > s;
2128         QPointer<QObject> ptr(&ob);
2129         s.insert(ptr);
2130         s.insert(ptr);
2131         s.insert(ptr);
2132         BREAK_HERE;
2133         // Expand s.
2134         // Check s <1 items> QSet<QPointer<QObject>>.
2135         // CheckType s.0 QPointer<QObject>.
2136         // Continue.
2137         dummyStatement(&ptr, &s);
2138     }
2139
2140     void testQSet()
2141     {
2142         testQSet1();
2143         testQSet2();
2144         testQSet3();
2145     }
2146
2147 } // namespace qset
2148
2149
2150 namespace qsharedpointer {
2151
2152     #if USE_SHARED_POINTER
2153
2154     class EmployeeData : public QSharedData
2155     {
2156     public:
2157         EmployeeData() : id(-1) { name.clear(); }
2158         EmployeeData(const EmployeeData &other)
2159             : QSharedData(other), id(other.id), name(other.name) { }
2160         ~EmployeeData() { }
2161
2162         int id;
2163         QString name;
2164     };
2165
2166     class Employee
2167     {
2168     public:
2169         Employee() { d = new EmployeeData; }
2170         Employee(int id, QString name) {
2171             d = new EmployeeData;
2172             setId(id);
2173             setName(name);
2174         }
2175         Employee(const Employee &other)
2176               : d (other.d)
2177         {
2178         }
2179         void setId(int id) { d->id = id; }
2180         void setName(QString name) { d->name = name; }
2181
2182         int id() const { return d->id; }
2183         QString name() const { return d->name; }
2184
2185        private:
2186          QSharedDataPointer<EmployeeData> d;
2187     };
2188
2189
2190     void testQSharedPointer1()
2191     {
2192         QSharedPointer<int> ptr(new int(43));
2193         QSharedPointer<int> ptr2 = ptr;
2194         QSharedPointer<int> ptr3 = ptr;
2195         BREAK_HERE;
2196         dummyStatement(&ptr, &ptr2, &ptr3);
2197     }
2198
2199     void testQSharedPointer2()
2200     {
2201         QSharedPointer<QString> ptr(new QString("hallo"));
2202         QSharedPointer<QString> ptr2 = ptr;
2203         QSharedPointer<QString> ptr3 = ptr;
2204         BREAK_HERE;
2205         dummyStatement(&ptr, &ptr2, &ptr3);
2206     }
2207
2208     void testQSharedPointer3()
2209     {
2210         QSharedPointer<int> iptr(new int(43));
2211         QWeakPointer<int> ptr(iptr);
2212         QWeakPointer<int> ptr2 = ptr;
2213         QWeakPointer<int> ptr3 = ptr;
2214         BREAK_HERE;
2215         dummyStatement(&ptr, &ptr2, &ptr3);
2216     }
2217
2218     void testQSharedPointer4()
2219     {
2220         QSharedPointer<QString> sptr(new QString("hallo"));
2221         QWeakPointer<QString> ptr(sptr);
2222         QWeakPointer<QString> ptr2 = ptr;
2223         QWeakPointer<QString> ptr3 = ptr;
2224         BREAK_HERE;
2225         dummyStatement(&ptr, &ptr2, &ptr3);
2226     }
2227
2228     void testQSharedPointer5()
2229     {
2230         QSharedPointer<Foo> fptr(new Foo(1));
2231         QWeakPointer<Foo> ptr(fptr);
2232         QWeakPointer<Foo> ptr2 = ptr;
2233         QWeakPointer<Foo> ptr3 = ptr;
2234         BREAK_HERE;
2235         dummyStatement(&ptr, &ptr2, &ptr3);
2236     }
2237
2238     void testQSharedPointer()
2239     {
2240         testQSharedPointer1();
2241         testQSharedPointer2();
2242         testQSharedPointer3();
2243         testQSharedPointer4();
2244         testQSharedPointer5();
2245     }
2246
2247     #else
2248
2249     void testQSharedPointer() {}
2250
2251     #endif
2252
2253 } // namespace qsharedpointer
2254
2255
2256 namespace qxml {
2257
2258     void testQXmlAttributes()
2259     {
2260         // only works with Python dumper
2261         QXmlAttributes atts;
2262         atts.append("name1", "uri1", "localPart1", "value1");
2263         atts.append("name2", "uri2", "localPart2", "value2");
2264         atts.append("name3", "uri3", "localPart3", "value3");
2265         BREAK_HERE;
2266         // Expand atts atts.attList atts.attList.1 atts.attList.2.
2267         // CheckType atts QXmlAttributes.
2268         // CheckType atts.[vptr] .
2269         // Check atts.attList <3 items> QXmlAttributes::AttributeList.
2270         // CheckType atts.attList.0 QXmlAttributes::Attribute.
2271         // Check atts.attList.0.localname "localPart1" QString.
2272         // Check atts.attList.0.qname "name1" QString.
2273         // Check atts.attList.0.uri "uri1" QString.
2274         // Check atts.attList.0.value "value1" QString.
2275         // CheckType atts.attList.1 QXmlAttributes::Attribute.
2276         // Check atts.attList.1.localname "localPart2" QString.
2277         // Check atts.attList.1.qname "name2" QString.
2278         // Check atts.attList.1.uri "uri2" QString.
2279         // Check atts.attList.1.value "value2" QString.
2280         // CheckType atts.attList.2 QXmlAttributes::Attribute.
2281         // Check atts.attList.2.localname "localPart3" QString.
2282         // Check atts.attList.2.qname "name3" QString.
2283         // Check atts.attList.2.uri "uri3" QString.
2284         // Check atts.attList.2.value "value3" QString.
2285         // CheckType atts.d QXmlAttributesPrivate.
2286         // Continue.
2287         dummyStatement();
2288     }
2289
2290 } // namespace qxml
2291
2292
2293 namespace stdarray {
2294
2295     void testStdArray()
2296     {
2297         #if USE_CXX11
2298         std::array<int, 4> a = { { 1, 2, 3, 4} };
2299         BREAK_HERE;
2300         // Expand a.
2301         // Check a <4 items> std::array<int, 4u>.
2302         // Continue.
2303         dummyStatement(&a);
2304         #endif
2305     }
2306
2307 } // namespace stdcomplex
2308
2309
2310
2311 namespace stdcomplex {
2312
2313     void testStdComplex()
2314     {
2315         std::complex<double> c(1, 2);
2316         BREAK_HERE;
2317         // Expand c.
2318         // Check c (1.000000, 2.000000) std::complex<double>.
2319         // Continue.
2320         dummyStatement(&c);
2321     }
2322
2323 } // namespace stdcomplex
2324
2325
2326 namespace stddeque {
2327
2328     void testStdDequeInt()
2329     {
2330         std::deque<int> deque;
2331         deque.push_back(1);
2332         deque.push_back(2);
2333         BREAK_HERE;
2334         // Expand deque.
2335         // Check deque <2 items> std::deque<int>.
2336         // Check deque.0 1 int.
2337         // Check deque.1 2 int.
2338         // Continue.
2339         dummyStatement(&deque);
2340     }
2341
2342     void testStdDequeIntStar()
2343     {
2344         // This is not supposed to work with the compiled dumpers.
2345         std::deque<int *> deque;
2346         deque.push_back(new int(1));
2347         deque.push_back(0);
2348         deque.push_back(new int(2));
2349         BREAK_HERE;
2350         // Expand deque.
2351         // Check deque <3 items> std::deque<int*>.
2352         // CheckType deque.0 int.
2353         // Check deque.1 0x0 int *.
2354         // Continue.
2355         deque.pop_back();
2356         deque.pop_front();
2357         deque.pop_front();
2358         dummyStatement(&deque);
2359     }
2360
2361     void testStdDequeFoo()
2362     {
2363         std::deque<Foo> deque;
2364         deque.push_back(1);
2365         deque.push_front(2);
2366         BREAK_HERE;
2367         // Expand deque deque.0 deque.1.
2368         // Check deque <2 items> std::deque<Foo>.
2369         // CheckType deque.0 Foo.
2370         // Check deque.0.a 2 int.
2371         // CheckType deque.1 Foo.
2372         // Check deque.1.a 1 int.
2373         // Continue.
2374         dummyStatement(&deque);
2375     }
2376
2377     void testStdDequeFooStar()
2378     {
2379         std::deque<Foo *> deque;
2380         deque.push_back(new Foo(1));
2381         deque.push_back(new Foo(2));
2382         BREAK_HERE;
2383         // Expand deque deque.0 deque.1.
2384         // Check deque <2 items> std::deque<Foo*>.
2385         // CheckType deque.0 Foo.
2386         // Check deque.0.a 1 int.
2387         // CheckType deque.1 Foo.
2388         // Check deque.1.a 2 int.
2389         // Continue.
2390         dummyStatement(&deque);
2391     }
2392
2393     void testStdDeque()
2394     {
2395         testStdDequeInt();
2396         testStdDequeIntStar();
2397         testStdDequeFoo();
2398         testStdDequeFooStar();
2399     }
2400
2401 } // namespace stddeque
2402
2403
2404 namespace stdhashset {
2405
2406     void testStdHashSet()
2407     {
2408         // This is not supposed to work with the compiled dumpers.
2409     #if USE_GCC_EXT
2410         using namespace __gnu_cxx;
2411         hash_set<int> h;
2412         h.insert(1);
2413         h.insert(194);
2414         h.insert(2);
2415         h.insert(3);
2416         BREAK_HERE;
2417         // Expand h.
2418         // Check h <4 items> __gnu__cxx::hash_set<int>.
2419         // Check h.0 194 int.
2420         // Check h.1 1 int.
2421         // Check h.2 2 int.
2422         // Check h.3 3 int.
2423         // Continue.
2424         dummyStatement(&h);
2425     #endif
2426     }
2427
2428 } // namespace stdhashset
2429
2430
2431 namespace stdlist {
2432
2433     void testStdListInt()
2434     {
2435         std::list<int> list;
2436         list.push_back(1);
2437         list.push_back(2);
2438         BREAK_HERE;
2439         // Expand list.
2440         // Check list <2 items> std::list<int>.
2441         // Check list.0 1 int.
2442         // Check list.1 2 int.
2443         // Continue.
2444         dummyStatement(&list);
2445     }
2446
2447     void testStdListIntStar()
2448     {
2449         std::list<int *> list;
2450         list.push_back(new int(1));
2451         list.push_back(0);
2452         list.push_back(new int(2));
2453         BREAK_HERE;
2454         // Expand list.
2455         // Check list <3 items> std::list<int*>.
2456         // CheckType list.0 int.
2457         // Check list.1 0x0 int *.
2458         // CheckType list.2 int.
2459         // Continue.
2460         dummyStatement(&list);
2461     }
2462
2463     void testStdListIntBig()
2464     {
2465         // This is not supposed to work with the compiled dumpers.
2466         std::list<int> list;
2467         for (int i = 0; i < 10000; ++i)
2468             list.push_back(i);
2469         BREAK_HERE;
2470         // Expand list.
2471         // Check list <more than 1000 items> std::list<int>.
2472         // Check list.0 0 int.
2473         // Check list.999 999 int.
2474         // Continue.
2475         dummyStatement(&list);
2476     }
2477
2478     void testStdListFoo()
2479     {
2480         std::list<Foo> list;
2481         list.push_back(15);
2482         list.push_back(16);
2483         BREAK_HERE;
2484         // Expand list list.0 list.1.
2485         // Check list <2 items> std::list<Foo>.
2486         // CheckType list.0 Foo.
2487         // Check list.0.a 15 int.
2488         // CheckType list.1 Foo.
2489         // Check list.1.a 16 int.
2490         // Continue.
2491         dummyStatement(&list);
2492     }
2493
2494     void testStdListFooStar()
2495     {
2496         std::list<Foo *> list;
2497         list.push_back(new Foo(1));
2498         list.push_back(0);
2499         list.push_back(new Foo(2));
2500         BREAK_HERE;
2501         // Expand list list.0 list.2.
2502         // Check list <3 items> std::list<Foo*>.
2503         // CheckType list.0 Foo.
2504         // Check list.0.a 1 int.
2505         // Check list.1 0x0 Foo *.
2506         // CheckType list.2 Foo.
2507         // Check list.2.a 2 int.
2508         // Continue.
2509         dummyStatement(&list);
2510     }
2511
2512     void testStdListBool()
2513     {
2514         std::list<bool> list;
2515         list.push_back(true);
2516         list.push_back(false);
2517         BREAK_HERE;
2518         // Expand list.
2519         // Check list <2 items> std::list<bool>.
2520         // Check list.0 true bool.
2521         // Check list.1 false bool.
2522         // Continue.
2523         dummyStatement(&list);
2524     }
2525
2526     void testStdList()
2527     {
2528         testStdListInt();
2529         testStdListIntStar();
2530         testStdListIntBig();
2531         testStdListFoo();
2532         testStdListFooStar();
2533         testStdListBool();
2534     }
2535
2536 } // namespace stdlist
2537
2538
2539 namespace stdmap {
2540
2541     void testStdMapStringFoo()
2542     {
2543         // This is not supposed to work with the compiled dumpers.
2544         std::map<QString, Foo> map;
2545         map["22.0"] = Foo(22);
2546         map["33.0"] = Foo(33);
2547         map["44.0"] = Foo(44);
2548         BREAK_HERE;
2549         // Expand map map.0 map.0.second map.2 map.2.second.
2550         // Check map <3 items> std::map<QString, Foo>.
2551         // Check map.0   std::pair<QString const, Foo>.
2552         // Check map.0.first "22.0" QString.
2553         // CheckType map.0.second Foo.
2554         // Check map.0.second.a 22 int.
2555         // Check map.1   std::pair<QString const, Foo>.
2556         // Check map.2.first "44.0" QString.
2557         // CheckType map.2.second Foo.
2558         // Check map.2.second.a 44 int.
2559         // Continue.
2560         dummyStatement(&map);
2561     }
2562
2563     void testStdMapCharStarFoo()
2564     {
2565         std::map<const char *, Foo> map;
2566         map["22.0"] = Foo(22);
2567         map["33.0"] = Foo(33);
2568         BREAK_HERE;
2569         // Expand map map.0 map.0.first map.0.second map.1 map.1.second.
2570         // Check map <2 items> std::map<char const*, Foo>.
2571         // Check map.0   std::pair<char const* const, Foo>.
2572         // CheckType map.0.first char *.
2573         // Check map.0.first.*first 50 '2' char.
2574         // CheckType map.0.second Foo.
2575         // Check map.0.second.a 22 int.
2576         // Check map.1   std::pair<char const* const, Foo>.
2577         // CheckType map.1.first char *.
2578         // Check map.1.first.*first 51 '3' char.
2579         // CheckType map.1.second Foo.
2580         // Check map.1.second.a 33 int.
2581         // Continue.
2582         dummyStatement(&map);
2583     }
2584
2585     void testStdMapUIntUInt()
2586     {
2587         std::map<uint, uint> map;
2588         map[11] = 1;
2589         map[22] = 2;
2590         BREAK_HERE;
2591         // Expand map.
2592         // Check map <2 items> std::map<unsigned int, unsigned int>.
2593         // Check map.11 1 unsigned int.
2594         // Check map.22 2 unsigned int.
2595         // Continue.
2596         dummyStatement(&map);
2597     }
2598
2599     void testStdMapUIntStringList()
2600     {
2601         std::map<uint, QStringList> map;
2602         map[11] = QStringList() << "11";
2603         map[22] = QStringList() << "22";
2604         BREAK_HERE;
2605         // Expand map map.0 map.0.first map.0.second map.1 map.1.second.
2606         // Check map <2 items> std::map<unsigned int, QStringList>.
2607         // Check map.0   std::pair<unsigned int const, QStringList>.
2608         // Check map.0.first 11 unsigned int.
2609         // Check map.0.second <1 items> QStringList.
2610         // Check map.0.second.0 "11" QString.
2611         // Check map.1   std::pair<unsigned int const, QStringList>.
2612         // Check map.1.first 22 unsigned int.
2613         // Check map.1.second <1 items> QStringList.
2614         // Check map.1.second.0 "22" QString.
2615         // Continue.
2616         dummyStatement(&map);
2617     }
2618
2619     void testStdMapUIntStringListTypedef()
2620     {
2621         typedef std::map<uint, QStringList> T;
2622         T map;
2623         map[11] = QStringList() << "11";
2624         map[22] = QStringList() << "22";
2625         BREAK_HERE;
2626         // Check map <2 items> stdmap::T.
2627         // Continue.
2628         dummyStatement(&map);
2629     }
2630
2631     void testStdMapUIntFloat()
2632     {
2633         std::map<uint, float> map;
2634         map[11] = 11.0;
2635         map[22] = 22.0;
2636         BREAK_HERE;
2637         // Expand map.
2638         // Check map <2 items> std::map<unsigned int, float>.
2639         // Check map.11 11 float.
2640         // Check map.22 22 float.
2641         // Continue.
2642         dummyStatement(&map);
2643     }
2644
2645     void testStdMapStringFloat()
2646     {
2647         std::map<QString, float> map;
2648         map["11.0"] = 11.0;
2649         map["22.0"] = 22.0;
2650         BREAK_HERE;
2651         // Expand map map.0 map.1.
2652         // Check map <2 items> std::map<QString, float>.
2653         // Check map.0   std::pair<QString const, float>.
2654         // Check map.0.first "11.0" QString.
2655         // Check map.0.second 11 float.
2656         // Check map.1   std::pair<QString const, float>.
2657         // Check map.1.first "22.0" QString.
2658         // Check map.1.second 22 float.
2659         // Continue.
2660         dummyStatement(&map);
2661     }
2662
2663     void testStdMapIntString()
2664     {
2665         std::map<int, QString> map;
2666         map[11] = "11.0";
2667         map[22] = "22.0";
2668         BREAK_HERE;
2669         // Expand map map.0 map.1.
2670         // Check map <2 items> std::map<int, QString>.
2671         // Check map.0   std::pair<int const, QString>.
2672         // Check map.0.first 11 int.
2673         // Check map.0.second "11.0" QString.
2674         // Check map.1   std::pair<int const, QString>.
2675         // Check map.1.first 22 int.
2676         // Check map.1.second "22.0" QString.
2677         // Continue.
2678         dummyStatement(&map);
2679     }
2680
2681     void testStdMapStringPointer()
2682     {
2683         QObject ob;
2684         std::map<QString, QPointer<QObject> > map;
2685         map["Hallo"] = QPointer<QObject>(&ob);
2686         map["Welt"] = QPointer<QObject>(&ob);
2687         map["."] = QPointer<QObject>(&ob);
2688         BREAK_HERE;
2689         // Expand map map.0 map.2.
2690         // Check map <3 items> std::map<QString, QPointer<QObject>>.
2691         // Check map.0   std::pair<QString const, QPointer<QObject>>.
2692         // Check map.0.first "." QString.
2693         // CheckType map.0.second QPointer<QObject>.
2694         // Check map.2   std::pair<QString const, QPointer<QObject>>.
2695         // Check map.2.first "Welt" QString.
2696         // Continue.
2697         dummyStatement(&map);
2698     }
2699
2700     void testStdMap()
2701     {
2702         testStdMapStringFoo();
2703         testStdMapCharStarFoo();
2704         testStdMapUIntUInt();
2705         testStdMapUIntStringList();
2706         testStdMapUIntStringListTypedef();
2707         testStdMapUIntFloat();
2708         testStdMapStringFloat();
2709         testStdMapIntString();
2710         testStdMapStringPointer();
2711     }
2712
2713 } // namespace stdmap
2714
2715
2716 namespace stdptr {
2717
2718     void testStdUniquePtrInt()
2719     {
2720         #ifdef USE_CXX11
2721         std::unique_ptr<int> p(new int(32));
2722         BREAK_HERE;
2723         // Check p 32 std::unique_ptr<int, std::default_delete<int> >.
2724         // Continue.
2725         dummyStatement(&p);
2726         #endif
2727     }
2728
2729     void testStdUniquePtrFoo()
2730     {
2731         #ifdef USE_CXX11
2732         std::unique_ptr<Foo> p(new Foo);
2733         BREAK_HERE;
2734         // Check p 32 std::unique_ptr<Foo, std::default_delete<Foo> >.
2735         // Continue.
2736         dummyStatement(&p);
2737         #endif
2738     }
2739
2740     void testStdSharedPtrInt()
2741     {
2742         #ifdef USE_CXX11
2743         std::shared_ptr<int> p(new int(32));
2744         BREAK_HERE;
2745         // Check p 32 std::shared_ptr<int, std::default_delete<int> >.
2746         // Continue.
2747         dummyStatement(&p);
2748         #endif
2749     }
2750
2751     void testStdSharedPtrFoo()
2752     {
2753         #ifdef USE_CXX11
2754         std::shared_ptr<Foo> p(new Foo);
2755         BREAK_HERE;
2756         // Check p 32 std::shared_ptr<Foo, std::default_delete<int> >.
2757         // Continue.
2758         dummyStatement(&p);
2759         #endif
2760     }
2761
2762     void testStdPtr()
2763     {
2764         testStdUniquePtrInt();
2765         testStdUniquePtrFoo();
2766         testStdSharedPtrInt();
2767         testStdSharedPtrFoo();
2768     }
2769
2770 } // namespace stdptr
2771
2772
2773 namespace stdset {
2774
2775     void testStdSetInt()
2776     {
2777         // This is not supposed to work with the compiled dumpers.
2778         std::set<int> set;
2779         set.insert(11);
2780         set.insert(22);
2781         set.insert(33);
2782         BREAK_HERE;
2783         // Check set <3 items> std::set<int>
2784         // Continue.
2785         dummyStatement(&set);
2786     }
2787
2788     void testStdSetString()
2789     {
2790         std::set<QString> set;
2791         set.insert("22.0");
2792         BREAK_HERE;
2793         // Expand set.
2794         // Check set <1 items> std::set<QString>.
2795         // Check set.0 "22.0" QString.
2796         // Continue.
2797         dummyStatement(&set);
2798     }
2799
2800     void testStdSetPointer()
2801     {
2802         QObject ob;
2803         std::set<QPointer<QObject> > hash;
2804         QPointer<QObject> ptr(&ob);
2805         BREAK_HERE;
2806         // Check hash <0 items> std::set<QPointer<QObject>, std::less<QPointer<QObject>>, std::allocator<QPointer<QObject>>>.
2807         // Check ob "" QObject.
2808         // CheckType ptr QPointer<QObject>.
2809         // Continue.
2810         dummyStatement(&ptr);
2811     }
2812
2813     void testStdSet()
2814     {
2815         testStdSetInt();
2816         testStdSetString();
2817         testStdSetPointer();
2818     }
2819
2820 } // namespace stdset
2821
2822
2823 namespace stdstack {
2824
2825     void testStdStack1()
2826     {
2827         // This does not work with the compiled dumpers.
2828         std::stack<int *> s;
2829         BREAK_HERE;
2830         // Check s <0 items> std::stack<int*>.
2831         // Continue.
2832         s.push(new int(1));
2833         BREAK_HERE;
2834         // Check s <1 items> std::stack<int*>.
2835         // Continue.
2836         s.push(0);
2837         BREAK_HERE;
2838         // Check s <2 items> std::stack<int*>.
2839         // Continue.
2840         s.push(new int(2));
2841         BREAK_HERE;
2842         // Expand s.
2843         // Check s <3 items> std::stack<int*>.
2844         // CheckType s.0 int.
2845         // Check s.1 0x0 int *.
2846         // CheckType s.2 int.
2847         // Continue.
2848         s.pop();
2849         BREAK_HERE;
2850         // Check s <2 items> std::stack<int*>.
2851         // Continue.
2852         s.pop();
2853         BREAK_HERE;
2854         // Check s <1 items> std::stack<int*>.
2855         // Continue.
2856         s.pop();
2857         BREAK_HERE;
2858         // Check s <0 items> std::stack<int*>.
2859         // Continue.
2860         dummyStatement(&s);
2861     }
2862
2863     void testStdStack2()
2864     {
2865         std::stack<int> s;
2866         BREAK_HERE;
2867         // Check s <0 items> std::stack<int>.
2868         // Continue.
2869         s.push(1);
2870         BREAK_HERE;
2871         // Check s <1 items> std::stack<int>.
2872         // Continue.
2873         s.push(2);
2874         BREAK_HERE;
2875         // Expand s.
2876         // Check s <2 items> std::stack<int>.
2877         // Check s.0 1 int.
2878         // Check s.1 2 int.
2879         // Continue.
2880         dummyStatement(&s);
2881     }
2882
2883     void testStdStack3()
2884     {
2885         std::stack<Foo *> s;
2886         BREAK_HERE;
2887         // Check s <0 items> std::stack<Foo*>.
2888         // Continue.
2889         s.push(new Foo(1));
2890         BREAK_HERE;
2891         // Check s <1 items> std::stack<Foo*>.
2892         // Continue.
2893         s.push(new Foo(2));
2894         BREAK_HERE;
2895         // Expand s s.0 s.1.
2896         // Check s <2 items> std::stack<Foo*>.
2897         // CheckType s.0 Foo.
2898         // Check s.0.a 1 int.
2899         // CheckType s.1 Foo.
2900         // Check s.1.a 2 int.
2901         // Continue.
2902         dummyStatement(&s);
2903     }
2904
2905     void testStdStack4()
2906     {
2907         std::stack<Foo> s;
2908         BREAK_HERE;
2909         // Check s <0 items> std::stack<Foo>.
2910         // Continue.
2911         s.push(1);
2912         BREAK_HERE;
2913         // Check s <1 items> std::stack<Foo>.
2914         // Continue.
2915         s.push(2);
2916         BREAK_HERE;
2917         // Expand s s.0 s.1.
2918         // Check s <2 items> std::stack<Foo>.
2919         // CheckType s.0 Foo.
2920         // Check s.0.a 1 int.
2921         // CheckType s.1 Foo.
2922         // Check s.1.a 2 int.
2923         // Continue.
2924         dummyStatement(&s);
2925     }
2926
2927     void testStdStack()
2928     {
2929         testStdStack1();
2930         testStdStack2();
2931         testStdStack3();
2932         testStdStack4();
2933     }
2934
2935 } // namespace stdstack
2936
2937
2938 namespace stdstring {
2939
2940     void testStdString1()
2941     {
2942         std::string str;
2943         std::wstring wstr;
2944         BREAK_HERE;
2945         // Check str "" std::string.
2946         // Check wstr "" std::wstring.
2947         // Continue.
2948         str += "b";
2949         wstr += wchar_t('e');
2950         str += "d";
2951         wstr += wchar_t('e');
2952         str += "e";
2953         str += "b";
2954         str += "d";
2955         str += "e";
2956         wstr += wchar_t('e');
2957         wstr += wchar_t('e');
2958         str += "e";
2959         BREAK_HERE;
2960         // Check str "bdebdee" std::string.
2961         // Check wstr "eeee" std::wstring.
2962         // Continue.
2963         dummyStatement(&str, &wstr);
2964     }
2965
2966     void testStdString2()
2967     {
2968         std::string str = "foo";
2969         QList<std::string> l;
2970         BREAK_HERE;
2971         // Check l <0 items> QList<std::string>.
2972         // Check str "foo" std::string.
2973         // Continue.
2974         l.push_back(str);
2975         BREAK_HERE;
2976         // Check l <1 items> QList<std::string>.
2977         // Continue.
2978         l.push_back(str);
2979         BREAK_HERE;
2980         // Check l <2 items> QList<std::string>.
2981         // Continue.
2982         l.push_back(str);
2983         BREAK_HERE;
2984         // Check l <3 items> QList<std::string>.
2985         // Continue.
2986         l.push_back(str);
2987         BREAK_HERE;
2988         // Expand l.
2989         // Check l <4 items> QList<std::string>.
2990         // CheckType l.0 std::string.
2991         // CheckType l.3 std::string.
2992         // Check str "foo" std::string.
2993         // Continue.
2994         dummyStatement(&str, &l);
2995     }
2996
2997     void testStdString3()
2998     {
2999         std::string str = "foo";
3000         std::vector<std::string> v;
3001         BREAK_HERE;
3002         // Check str "foo" std::string.
3003         // Check v <0 items> std::vector<std::string>.
3004         // Continue.
3005         v.push_back(str);
3006         BREAK_HERE;
3007         // Check v <1 items> std::vector<std::string>.
3008         // Continue.
3009         v.push_back(str);
3010         BREAK_HERE;
3011         // Check v <2 items> std::vector<std::string>.
3012         // Continue.
3013         v.push_back(str);
3014         BREAK_HERE;
3015         // Check v <3 items> std::vector<std::string>.
3016         // Continue.
3017         v.push_back(str);
3018         BREAK_HERE;
3019         // Expand v.
3020         // Check v <4 items> std::vector<std::string>.
3021         // Check v.0 "foo" std::string.
3022         // Check v.3 "foo" std::string.
3023         // Continue.
3024         dummyStatement(&str, &v);
3025     }
3026
3027     void testStdString()
3028     {
3029         testStdString1();
3030         testStdString2();
3031         testStdString3();
3032     }
3033
3034 } // namespace stdstring
3035
3036
3037 namespace stdvector {
3038
3039     void testStdVector1()
3040     {
3041         std::vector<int *> v;
3042         BREAK_HERE;
3043         // Check v <0 items> std::vector<int*>.
3044         // Continue.
3045         v.push_back(new int(1));
3046         BREAK_HERE;
3047         // Check v <1 items> std::vector<int*>.
3048         // Continue.
3049         v.push_back(0);
3050         BREAK_HERE;
3051         // Check v <2 items> std::vector<int*>.
3052         // Continue.
3053         v.push_back(new int(2));
3054         BREAK_HERE;
3055         // Expand v.
3056         // Check v <3 items> std::vector<int*>.
3057         // Check v.0 1 int.
3058         // Check v.1 0x0 int *.
3059         // Check v.2 2 int.
3060         // Continue.
3061         dummyStatement(&v);
3062     }
3063
3064     void testStdVector2()
3065     {
3066         std::vector<int> v;
3067         v.push_back(1);
3068         v.push_back(2);
3069         v.push_back(3);
3070         v.push_back(4);
3071         BREAK_HERE;
3072         // Expand v.
3073         // Check v <4 items> std::vector<int>.
3074         // Check v.0 1 int.
3075         // Check v.3 4 int.
3076         // Continue.
3077         dummyStatement(&v);
3078     }
3079
3080     void testStdVector3()
3081     {
3082         std::vector<Foo *> v;
3083         v.push_back(new Foo(1));
3084         v.push_back(0);
3085         v.push_back(new Foo(2));
3086         BREAK_HERE;
3087         // Expand v v.0 v.0.x v.2.
3088         // Check v <3 items> std::vector<Foo*>.
3089         // CheckType v.0 Foo.
3090         // Check v.0.a 1 int.
3091         // Check v.1 0x0 Foo *.
3092         // CheckType v.2 Foo.
3093         // Check v.2.a 2 int.
3094         // Continue.
3095         dummyStatement(&v);
3096     }
3097
3098     void testStdVector4()
3099     {
3100         std::vector<Foo> v;
3101         v.push_back(1);
3102         v.push_back(2);
3103         v.push_back(3);
3104         v.push_back(4);
3105         BREAK_HERE;
3106         // Expand v v.0 v.0.x.
3107         // Check v <4 items> std::vector<Foo>.
3108         // CheckType v.0 Foo.
3109         // Check v.1.a 2 int.
3110         // CheckType v.3 Foo.
3111         // Continue.
3112         dummyStatement(&v);
3113     }
3114
3115     void testStdVectorBool1()
3116     {
3117         std::vector<bool> v;
3118         v.push_back(true);
3119         v.push_back(false);
3120         v.push_back(false);
3121         v.push_back(true);
3122         v.push_back(false);
3123         BREAK_HERE;
3124         // Expand v.
3125         // Check v <5 items> std::vector<bool>.
3126         // Check v.0 true bool.
3127         // Check v.1 false bool.
3128         // Check v.2 false bool.
3129         // Check v.3 true bool.
3130         // Check v.4 false bool.
3131         // Continue.
3132         dummyStatement(&v);
3133     }
3134
3135     void testStdVectorBool2()
3136     {
3137         std::vector<bool> v1(65, true);
3138         std::vector<bool> v2(65);
3139         BREAK_HERE;
3140         // Expand v1.
3141         // Expand v2.
3142         // Check v1 <65 items> std::vector<bool>.
3143         // Check v1.0 true bool.
3144         // Check v1.64 true bool.
3145         // Check v2 <65 items> std::vector<bool>.
3146         // Check v2.0 false bool.
3147         // Check v2.64 false bool.
3148         // Continue.
3149         dummyStatement(&v1, &v2);
3150     }
3151
3152     void testStdVector6()
3153     {
3154         std::vector<std::list<int> *> vector;
3155         std::list<int> list;
3156         vector.push_back(new std::list<int>(list));
3157         vector.push_back(0);
3158         list.push_back(45);
3159         vector.push_back(new std::list<int>(list));
3160         vector.push_back(0);
3161         BREAK_HERE;
3162         // Expand list vector vector.2.
3163         // Check list <1 items> std::list<int>.
3164         // Check list.0 45 int.
3165         // Check vector <4 items> std::vector<std::list<int>*>.
3166         // Check vector.0 <0 items> std::list<int>.
3167         // Check vector.2 <1 items> std::list<int>.
3168         // Check vector.2.0 45 int.
3169         // Check vector.3 0x0 std::list<int> *.
3170         // Continue.
3171         dummyStatement(&vector, &list);
3172     }
3173
3174     void testStdVector()
3175     {
3176         testStdVector1();
3177         testStdVector2();
3178         testStdVector3();
3179         testStdVector4();
3180         testStdVectorBool1();
3181         testStdVectorBool2();
3182         testStdVector6();
3183     }
3184
3185 } // namespace stdvector
3186
3187
3188 namespace stdstream {
3189
3190     void testStdStream()
3191     {
3192         using namespace std;
3193         ifstream is;
3194         BREAK_HERE;
3195         // CheckType is std::ifstream.
3196         // Continue.
3197         is.open("/etc/passwd");
3198         BREAK_HERE;
3199         // Continue.
3200         bool ok = is.good();
3201         BREAK_HERE;
3202         // Check ok true bool.
3203         // Continue.
3204         dummyStatement(&is, &ok);
3205     }
3206
3207 } // namespace stdstream
3208
3209
3210 namespace itemmodel {
3211
3212     void testItemModel()
3213     {
3214         //char buf[100];
3215         //QString *s = static_cast<QString *>(static_cast<void *>(&(v.data_ptr().data.c)));
3216         //QString *t = (QString *)&(v.data_ptr());
3217
3218         QStandardItemModel m;
3219         QStandardItem *i1, *i2, *i11;
3220         m.appendRow(QList<QStandardItem *>()
3221              << (i1 = new QStandardItem("1")) << (new QStandardItem("a")) << (new QStandardItem("a2")));
3222         QModelIndex mi = i1->index();
3223         m.appendRow(QList<QStandardItem *>()
3224              << (i2 = new QStandardItem("2")) << (new QStandardItem("b")));
3225         i1->appendRow(QList<QStandardItem *>()
3226              << (i11 = new QStandardItem("11")) << (new QStandardItem("aa")));
3227         BREAK_HERE;
3228         // CheckType i1 QStandardItem.
3229         // CheckType i11 QStandardItem.
3230         // CheckType i2 QStandardItem.
3231         // Check m "" QStandardItemModel.
3232         // Check mi "1" QModelIndex.
3233         // Continue.
3234         dummyStatement(&i1, &mi, &m, &i2, &i11);
3235     }
3236
3237 } // namespace itemmodel
3238
3239
3240 namespace qstack {
3241
3242     void testQStackInt()
3243     {
3244         QStack<int> s;
3245         s.append(1);
3246         s.append(2);
3247         BREAK_HERE;
3248         // Expand s.
3249         // Check s <2 items> QStack<int>.
3250         // Check s.0 1 int.
3251         // Check s.1 2 int.
3252         // Continue.
3253         dummyStatement(&s);
3254     }
3255
3256     void testQStackBig()
3257     {
3258         QStack<int> s;
3259         for (int i = 0; i != 10000; ++i)
3260             s.append(i);
3261         BREAK_HERE;
3262         // Expand s.
3263         // Check s <10000 items> QStack<int>.
3264         // Check s.0 0 int.
3265         // Check s.1999 1999 int.
3266         // Continue.
3267         dummyStatement(&s);
3268     }
3269
3270     void testQStackFooPointer()
3271     {
3272         QStack<Foo *> s;
3273         s.append(new Foo(1));
3274         s.append(0);
3275         s.append(new Foo(2));
3276         BREAK_HERE;
3277         // Expand s s.0 s.2.
3278         // Check s <3 items> QStack<Foo*>.
3279         // CheckType s.0 Foo.
3280         // Check s.0.a 1 int.
3281         // Check s.1 0x0 Foo *.
3282         // CheckType s.2 Foo.
3283         // Check s.2.a 2 int.
3284         // Continue.
3285         dummyStatement(&s);
3286     }
3287
3288     void testQStackFoo()
3289     {
3290         QStack<Foo> s;
3291         s.append(1);
3292         s.append(2);
3293         s.append(3);
3294         s.append(4);
3295         BREAK_HERE;
3296         // Expand s s.0 s.3.
3297         // Check s <4 items> QStack<Foo>.
3298         // CheckType s.0 Foo.
3299         // Check s.0.a 1 int.
3300         // CheckType s.3 Foo.
3301         // Check s.3.a 4 int.
3302         // Continue.
3303         dummyStatement(&s);
3304     }
3305
3306     void testQStackBool()
3307     {
3308         QStack<bool> s;
3309         s.append(true);
3310         s.append(false);
3311         BREAK_HERE;
3312         // Expand s.
3313         // Check s <2 items> QStack<bool>.
3314         // Check s.0 true bool.
3315         // Check s.1 false bool.
3316         // Continue.
3317         dummyStatement(&s);
3318     }
3319
3320     void testQStack()
3321     {
3322         testQStackInt();
3323         testQStackBig();
3324         testQStackFoo();
3325         testQStackFooPointer();
3326         testQStackBool();
3327     }
3328
3329 } // namespace qstack
3330
3331
3332 namespace qurl {
3333
3334     void testQUrl()
3335     {
3336         QUrl url(QString("http://www.nokia.com"));
3337         BREAK_HERE;
3338         // Check url "http://www.nokia.com" QUrl.
3339         // Continue.
3340         dummyStatement(&url);
3341     }
3342
3343 } // namespace qurl
3344
3345
3346 namespace qstring  {
3347
3348     void testQStringQuotes()
3349     {
3350         QString str1("Hello Qt"); // --> Value: "Hello Qt"
3351         QString str2("Hello\nQt"); // --> Value: ""Hello\nQt"" (double quote not expected)
3352         QString str3("Hello\rQt"); // --> Value: ""HelloQt"" (double quote and missing \r not expected)
3353         QString str4("Hello\tQt"); // --> Value: "Hello\9Qt" (expected \t instead of \9)
3354         BREAK_HERE;
3355         // Check str1 "Hello Qt" QString.
3356         // Check str2 "Hello\nQt" QString.
3357         // Check str3 "Hello\rQt" QString.
3358         // Check str4 "Hello\tQt" QString.
3359         // Continue.
3360         dummyStatement(&str1, &str2, &str3, &str4);
3361     }
3362
3363     void testQString1()
3364     {
3365         QString str = "Hello ";
3366         str += " big, ";
3367         str += "\t";
3368         str += "\r";
3369         str += "\n";
3370         str += QLatin1Char(0);
3371         str += QLatin1Char(1);
3372         str += " fat ";
3373         str += " World ";
3374         str += " World ";
3375         BREAK_HERE;
3376         // Check str "Hello  big, \t\r\n\000\001 fat  World  World " QString.
3377         // Continue.
3378         dummyStatement(&str);
3379     }
3380
3381     void stringRefTest(const QString &refstring)
3382     {
3383         dummyStatement(&refstring);
3384     }
3385
3386     void testQString3()
3387     {
3388         QString str = "Hello ";
3389         str += " big, ";
3390         str += " fat ";
3391         str += " World ";
3392
3393         QString string("String Test");
3394         QString *pstring = new QString("Pointer String Test");
3395         stringRefTest(QString("Ref String Test"));
3396         string = "Hi";
3397         string += "Du";
3398         qDebug() << string;
3399         BREAK_HERE;
3400         // CheckType pstring QString.
3401         // Check str "Hello  big,  fat  World " QString.
3402         // Check string "HiDu" QString.
3403         // Continue.
3404         delete pstring;
3405         dummyStatement(&str, &string, pstring);
3406     }
3407
3408     void testQString()
3409     {
3410         testQString1();
3411         testQString3();
3412         testQStringQuotes();
3413     }
3414
3415 } // namespace qstring
3416
3417
3418 namespace qstringlist {
3419
3420     void testQStringList()
3421     {
3422         QStringList l;
3423         l << "Hello ";
3424         l << " big, ";
3425         l << " fat ";
3426         l.takeFirst();
3427         l << " World ";
3428         BREAK_HERE;
3429         // Expand l.
3430         // Check l <3 items> QStringList.
3431         // Check l.0 " big, " QString.
3432         // Check l.1 " fat " QString.
3433         // Check l.2 " World " QString.
3434         // Continue.
3435         dummyStatement(&l);
3436     }
3437
3438 } // namespace qstringlist
3439
3440
3441 namespace formats {
3442
3443     void testString()
3444     {
3445         const wchar_t *w = L"aöa";
3446         QString u;
3447         if (sizeof(wchar_t) == 4)
3448             u = QString::fromUcs4((uint *)w);
3449         else
3450             u = QString::fromUtf16((ushort *)w);
3451         BREAK_HERE;
3452         // Check u "aöa" QString.
3453         // CheckType w wchar_t *.
3454         // Continue.
3455
3456         // All: Select UTF-8 in "Change Format for Type" in L&W context menu.
3457         // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu.
3458         // Other: Select UCS-6 in "Change Format for Type" in L&W context menu.
3459         dummyStatement(&u, &w);
3460     }
3461
3462     void testCharPointers()
3463     {
3464         // These tests should result in properly displayed umlauts in the
3465         // Locals&Watchers view. It is only support on gdb with Python.
3466
3467         const char *s = "aöa";
3468         const char *t = "a\xc3\xb6";
3469         const wchar_t *w = L"aöa";
3470         BREAK_HERE;
3471         // CheckType s char *.
3472         // CheckType t char *.
3473         // CheckType w wchar_t *.
3474         // Continue.
3475
3476         // All: Select UTF-8 in "Change Format for Type" in L&W context menu.
3477         // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu.
3478         // Other: Select UCS-6 in "Change Format for Type" in L&W context menu.
3479
3480         const unsigned char uu[] = { 'a', 153 /* ö Latin1 */, 'a' };
3481         const unsigned char *u = uu;
3482         BREAK_HERE;
3483         // CheckType u unsigned char *.
3484         // CheckType uu unsigned char [3].
3485         // Continue.
3486
3487         // Make sure to undo "Change Format".
3488         dummyStatement(&s, &w, &t, &u);
3489     }
3490
3491     void testCharArrays()
3492     {
3493         // These tests should result in properly displayed umlauts in the
3494         // Locals&Watchers view. It is only support on gdb with Python.
3495
3496         const char s[] = "aöa";
3497         const char t[] = "aöax";
3498         const wchar_t w[] = L"aöa";
3499         BREAK_HERE;
3500         // CheckType s char [5].
3501         // CheckType t char [6].
3502         // CheckType w wchar_t [4].
3503         // Continue.
3504
3505         // All: Select UTF-8 in "Change Format for Type" in L&W context menu.
3506         // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu.
3507         // Other: Select UCS-6 in "Change Format for Type" in L&W context menu.
3508
3509         // Make sure to undo "Change Format".
3510         dummyStatement(&s, &w, &t);
3511     }
3512
3513     void testFormats()
3514     {
3515         testCharPointers();
3516         testCharArrays();
3517         testString();
3518     }
3519
3520 } // namespace formats
3521
3522
3523 namespace text {
3524
3525     void testText()
3526     {
3527         //char *argv[] = { "xxx", 0 };
3528         QTextDocument doc;
3529         doc.setPlainText("Hallo\nWorld");
3530         QTextCursor tc;
3531         BREAK_HERE;
3532         // CheckType doc QTextDocument.
3533         // Continue.
3534         tc = doc.find("all");
3535         BREAK_HERE;
3536         // Check tc 4 QTextCursor.
3537         // Continue.
3538         int pos = tc.position();
3539         BREAK_HERE;
3540         // Check pos 4 int.
3541         // Continue.
3542         int anc = tc.anchor();
3543         BREAK_HERE;
3544         // Check anc 1 int.
3545         // Continue.
3546         dummyStatement(&pos, &anc);
3547     }
3548
3549 } // namespace text
3550
3551
3552 namespace qthread {
3553
3554     class Thread : public QThread
3555     {
3556     public:
3557         Thread() {}
3558
3559         void setId(int id) { m_id = id; }
3560
3561         void run()
3562         {
3563             int j = 2;
3564             ++j;
3565             for (int i = 0; i != 1000; ++i) {
3566                 //sleep(1);
3567                 std::cerr << m_id;
3568             }
3569             if (m_id == 2) {
3570                 ++j;
3571             }
3572             if (m_id == 3) {
3573                 BREAK_HERE;
3574                 // Expand this.
3575                 // Check j 3 int.
3576                 // CheckType this qthread::Thread.
3577                 // Check this.@1 "This is thread #3" QThread.
3578                 // Continue.
3579                 dummyStatement(this);
3580             }
3581             std::cerr << j;
3582         }
3583
3584     private:
3585         int m_id;
3586     };
3587
3588     void testQThread()
3589     {
3590         //return;
3591         const int N = 14;
3592         Thread thread[N];
3593         for (int i = 0; i != N; ++i) {
3594             thread[i].setId(i);
3595             thread[i].setObjectName("This is thread #" + QString::number(i));
3596             thread[i].start();
3597         }
3598         BREAK_HERE;
3599         // Expand thread.
3600         // CheckType thread qthread::Thread [14].
3601         // Check thread.0 "This is thread #0" qthread::Thread.
3602         // Check thread.13 "This is thread #13" qthread::Thread.
3603         // Continue.
3604         for (int i = 0; i != N; ++i) {
3605             thread[i].wait();
3606         }
3607         dummyStatement(&thread);
3608     }
3609 }
3610
3611
3612 Q_DECLARE_METATYPE(QHostAddress)
3613 Q_DECLARE_METATYPE(QList<int>)
3614 Q_DECLARE_METATYPE(QStringList)
3615 #define COMMA ,
3616 Q_DECLARE_METATYPE(QMap<uint COMMA QStringList>)
3617
3618 namespace qvariant {
3619
3620     void testQVariant1()
3621     {
3622         QVariant value;
3623         QVariant::Type t = QVariant::String;
3624         value = QVariant(t, (void*)0);
3625         *(QString*)value.data() = QString("Some string");
3626         int i = 1;
3627         BREAK_HERE;
3628         // Check t QVariant::String (10) QVariant::Type.
3629         // Check value "Some string" QVariant (QString).
3630         // Continue.
3631
3632         // Check the variant contains a proper QString.
3633         dummyStatement(&i);
3634     }
3635
3636     void testQVariant2()
3637     {
3638         // Check var contains objects of the types indicated.
3639
3640         QVariant var;                        // Type 0, invalid
3641         BREAK_HERE;
3642         // Check var (invalid) QVariant (invalid).
3643         // Continue.
3644         var.setValue(true);                  // 1, bool
3645         BREAK_HERE;
3646         // Check var true QVariant (bool).
3647         // Continue.
3648         var.setValue(2);                     // 2, int
3649         BREAK_HERE;
3650         // Check var 2 QVariant (int).
3651         // Continue.
3652         var.setValue(3u);                    // 3, uint
3653         BREAK_HERE;
3654         // Check var 3 QVariant (uint).
3655         // Continue.
3656         var.setValue(qlonglong(4));          // 4, qlonglong
3657         BREAK_HERE;
3658         // Check var 4 QVariant (qlonglong).
3659         // Continue.
3660         var.setValue(qulonglong(5));         // 5, qulonglong
3661         BREAK_HERE;
3662         // Check var 5 QVariant (qulonglong).
3663         // Continue.
3664         var.setValue(double(6));             // 6, double
3665         BREAK_HERE;
3666         // Check var 6 QVariant (double).
3667         // Continue.
3668         var.setValue(QChar(7));              // 7, QChar
3669         BREAK_HERE;
3670         // Check var '?' (7) QVariant (QChar).
3671         // Continue.
3672         //None,          # 8, QVariantMap
3673         // None,          # 9, QVariantList
3674         var.setValue(QString("Hello 10"));   // 10, QString
3675         BREAK_HERE;
3676         // Check var "Hello 10" QVariant (QString).
3677         // Continue.
3678         var.setValue(QRect(100, 200, 300, 400)); // 19 QRect
3679         BREAK_HERE;
3680         // Check var 300x400+100+200 QVariant (QRect).
3681         // Continue.
3682         var.setValue(QRectF(100, 200, 300, 400)); // 19 QRectF
3683         BREAK_HERE;
3684         // Check var 300x400+100+200 QVariant (QRectF).
3685         // Continue.
3686
3687         /*
3688          "QStringList", # 11
3689          "QByteArray",  # 12
3690          "QBitArray",   # 13
3691          "QDate",       # 14
3692          "QTime",       # 15
3693          "QDateTime",   # 16
3694          "QUrl",        # 17
3695          "QLocale",     # 18
3696          "QRect",       # 19
3697          "QRectF",      # 20
3698          "QSize",       # 21
3699          "QSizeF",      # 22
3700          "QLine",       # 23
3701          "QLineF",      # 24
3702          "QPoint",      # 25
3703          "QPointF",     # 26
3704          "QRegExp",     # 27
3705          */
3706         dummyStatement(&var);
3707     }
3708
3709     void testQVariant3()
3710     {
3711         QVariant var;
3712         BREAK_HERE;
3713         // Check var (invalid) QVariant (invalid).
3714         // Continue.
3715
3716         // Check the list is updated properly.
3717         var.setValue(QStringList() << "World");
3718         BREAK_HERE;
3719         // Expand var.
3720         // Check var <1 items> QVariant (QStringList).
3721         // Check var.0 "World" QString.
3722         // Continue.
3723         var.setValue(QStringList() << "World" << "Hello");
3724         BREAK_HERE;
3725         // Expand var.
3726         // Check var <2 items> QVariant (QStringList).
3727         // Check var.1 "Hello" QString.
3728         // Continue.
3729         var.setValue(QStringList() << "Hello" << "Hello");
3730         BREAK_HERE;
3731         // Expand var.
3732         // Check var <2 items> QVariant (QStringList).
3733         // Check var.0 "Hello" QString.
3734         // Check var.1 "Hello" QString.
3735         // Continue.
3736         var.setValue(QStringList() << "World" << "Hello" << "Hello");
3737         BREAK_HERE;
3738         // Expand var.
3739         // Check var <3 items> QVariant (QStringList).
3740         // Check var.0 "World" QString.
3741         // Continue.
3742         dummyStatement(&var);
3743     }
3744
3745     void testQVariant4()
3746     {
3747         QVariant var;
3748         QHostAddress ha("127.0.0.1");
3749         var.setValue(ha);
3750         QHostAddress ha1 = var.value<QHostAddress>();
3751         BREAK_HERE;
3752         // Expand ha ha1 var.
3753         // Check ha "127.0.0.1" QHostAddress.
3754         // Check ha.a 0 quint32.
3755         // CheckType ha.a6 Q_IPV6ADDR.
3756         // Check ha.ipString "127.0.0.1" QString.
3757         // Check ha.isParsed false bool.
3758         // Check ha.protocol QAbstractSocket::UnknownNetworkLayerProtocol (-1) QAbstractSocket::NetworkLayerProtocol.
3759         // Check ha.scopeId "" QString.
3760         // Check ha1 "127.0.0.1" QHostAddress.
3761         // Check ha1.a 0 quint32.
3762         // CheckType ha1.a6 Q_IPV6ADDR.
3763         // Check ha1.ipString "127.0.0.1" QString.
3764         // Check ha1.isParsed false bool.
3765         // Check ha1.protocol QAbstractSocket::UnknownNetworkLayerProtocol (-1) QAbstractSocket::NetworkLayerProtocol.
3766         // Check ha1.scopeId "" QString.
3767         // CheckType var QVariant (QHostAddress).
3768         // Check var.data "127.0.0.1" QHostAddress.
3769         // Continue.
3770         dummyStatement(&ha1);
3771     }
3772
3773     void testQVariant5()
3774     {
3775         // This checks user defined types in QVariants.
3776         typedef QMap<uint, QStringList> MyType;
3777         MyType my;
3778         my[1] = (QStringList() << "Hello");
3779         my[3] = (QStringList() << "World");
3780         QVariant var;
3781         var.setValue(my);
3782         // FIXME: Known to break
3783         //QString type = var.typeName();
3784         var.setValue(my);
3785         BREAK_HERE;
3786         // Expand my my.0 my.0.value my.1 my.1.value var var.data var.data.0 var.data.0.value var.data.1 var.data.1.value.
3787         // Check my <2 items> qvariant::MyType.
3788         // Check my.0   QMapNode<unsigned int, QStringList>.
3789         // Check my.0.key 1 unsigned int.
3790         // Check my.0.value <1 items> QStringList.
3791         // Check my.0.value.0 "Hello" QString.
3792         // Check my.1   QMapNode<unsigned int, QStringList>.
3793         // Check my.1.key 3 unsigned int.
3794         // Check my.1.value <1 items> QStringList.
3795         // Check my.1.value.0 "World" QString.
3796         // CheckType var QVariant (QMap<unsigned int , QStringList>).
3797         // Check var.data <2 items> QMap<unsigned int, QStringList>.
3798         // Check var.data.0   QMapNode<unsigned int, QStringList>.
3799         // Check var.data.0.key 1 unsigned int.
3800         // Check var.data.0.value <1 items> QStringList.
3801         // Check var.0.value.0 "Hello" QString.
3802         // Check var.data.1   QMapNode<unsigned int, QStringList>.
3803         // Check var.data.1.key 3 unsigned int.
3804         // Check var.data.1.value <1 items> QStringList.
3805         // Check var.data.1.value.0 "World" QString.
3806         // Continue.
3807         var.setValue(my);
3808         var.setValue(my);
3809         var.setValue(my);
3810         dummyStatement(&var);
3811     }
3812
3813     void testQVariant6()
3814     {
3815         QList<int> list;
3816         list << 1 << 2 << 3;
3817         QVariant variant = qVariantFromValue(list);
3818         BREAK_HERE;
3819         // Expand list variant variant.data.
3820         // Check list <3 items> QList<int>.
3821         // Check list.0 1 int.
3822         // Check list.1 2 int.
3823         // Check list.2 3 int.
3824         // CheckType variant QVariant (QList<int>).
3825         // Check variant.data <3 items> QList<int>.
3826         // Check variant.data.0 1 int.
3827         // Check variant.data.1 2 int.
3828         // Check variant.data.2 3 int.
3829         // Continue.
3830         list.clear();
3831         list = qVariantValue<QList<int> >(variant);
3832         BREAK_HERE;
3833         // Expand list.
3834         // Check list <3 items> QList<int>.
3835         // Check list.0 1 int.
3836         // Check list.1 2 int.
3837         // Check list.2 3 int.
3838         // Continue.
3839         dummyStatement(&list);
3840     }
3841
3842     void testQVariantList()
3843     {
3844         QVariantList vl;
3845         BREAK_HERE;
3846         // Check vl <0 items> QVariantList.
3847         // Continue.
3848         vl.append(QVariant(1));
3849         vl.append(QVariant(2));
3850         vl.append(QVariant("Some String"));
3851         vl.append(QVariant(21));
3852         vl.append(QVariant(22));
3853         vl.append(QVariant("2Some String"));
3854         BREAK_HERE;
3855         // Expand vl.
3856         // Check vl <6 items> QVariantList.
3857         // CheckType vl.0 QVariant (int).
3858         // CheckType vl.2 QVariant (QString).
3859         // Continue.
3860         dummyStatement(&vl);
3861     }
3862
3863     void testQVariantMap()
3864     {
3865         QVariantMap vm;
3866         BREAK_HERE;
3867         // Check vm <0 items> QVariantMap.
3868         // Continue.
3869         vm["a"] = QVariant(1);
3870         vm["b"] = QVariant(2);
3871         vm["c"] = QVariant("Some String");
3872         vm["d"] = QVariant(21);
3873         vm["e"] = QVariant(22);
3874         vm["f"] = QVariant("2Some String");
3875         BREAK_HERE;
3876         // Expand vm vm.0 vm.5.
3877         // Check vm <6 items> QVariantMap.
3878         // Check vm.0   QMapNode<QString, QVariant>.
3879         // Check vm.0.key "a" QString.
3880         // Check vm.0.value 1 QVariant (int).
3881         // Check vm.5   QMapNode<QString, QVariant>.
3882         // Check vm.5.key "f" QString.
3883         // Check vm.5.value "2Some String" QVariant (QString).
3884         // Continue.
3885         dummyStatement(&vm);
3886     }
3887
3888     void testQVariant()
3889     {
3890         testQVariant1();
3891         testQVariant2();
3892         testQVariant3();
3893         testQVariant4();
3894         testQVariant5();
3895         testQVariant6();
3896         testQVariantList();
3897         testQVariantMap();
3898     }
3899
3900 } // namespace qvariant
3901
3902
3903 namespace qvector {
3904
3905     void testQVectorIntBig()
3906     {
3907         // This tests the display of a big vector.
3908         QVector<int> vec(10000);
3909         BREAK_HERE;
3910         // Expand vec.
3911         // Check vec <10000 items> QVector<int>.
3912         // Check vec.0 0 int.
3913         // Check vec.1999 0 int.
3914         // Continue.
3915
3916         // step over
3917         // check that the display updates in reasonable time
3918         vec[1] = 1;
3919         vec[2] = 2;
3920         vec.append(1);
3921         vec.append(1);
3922         BREAK_HERE;
3923         // Expand vec.
3924         // Check vec <10002 items> QVector<int>.
3925         // Check vec.1 1 int.
3926         // Check vec.2 2 int.
3927         // Continue.
3928         dummyStatement(&vec);
3929     }
3930
3931     void testQVectorFoo()
3932     {
3933         // This tests the display of a vector of pointers to custom structs.
3934         QVector<Foo> vec;
3935         BREAK_HERE;
3936         // Check vec <0 items> QVector<Foo>.
3937         // Continue.
3938         // step over, check display.
3939         vec.append(1);
3940         vec.append(2);
3941         BREAK_HERE;
3942         // Expand vec vec.0 vec.1.
3943         // Check vec <2 items> QVector<Foo>.
3944         // CheckType vec.0 Foo.
3945         // Check vec.0.a 1 int.
3946         // CheckType vec.1 Foo.
3947         // Check vec.1.a 2 int.
3948         // Continue.
3949         dummyStatement(&vec);
3950     }
3951
3952     typedef QVector<Foo> FooVector;
3953
3954     void testQVectorFooTypedef()
3955     {
3956         FooVector vec;
3957         vec.append(Foo(2));
3958         vec.append(Foo(3));
3959         dummyStatement(&vec);
3960     }
3961
3962     void testQVectorFooStar()
3963     {
3964         // This tests the display of a vector of pointers to custom structs.
3965         QVector<Foo *> vec;
3966         BREAK_HERE;
3967         // Check vec <0 items> QVector<Foo*>.
3968         // Continue.
3969         // step over
3970         // check that the display is ok.
3971         vec.append(new Foo(1));
3972         vec.append(0);
3973         vec.append(new Foo(2));
3974         // switch "Auto derefencing pointers" in Locals context menu
3975         // off and on again, and check result looks sane.
3976         BREAK_HERE;
3977         // Expand vec vec.0 vec.2.
3978         // Check vec <3 items> QVector<Foo*>.
3979         // CheckType vec.0 Foo.
3980         // Check vec.0.a 1 int.
3981         // Check vec.1 0x0 Foo *.
3982         // CheckType vec.2 Foo.
3983         // Check vec.2.a 2 int.
3984         // Continue.
3985         dummyStatement(&vec);
3986     }
3987
3988     void testQVectorBool()
3989     {
3990         // This tests the display of a vector of custom structs.
3991         QVector<bool> vec;
3992         BREAK_HERE;
3993         // Check vec <0 items> QVector<bool>.
3994         // Continue.
3995         // step over
3996         // check that the display is ok.
3997         vec.append(true);
3998         vec.append(false);
3999         BREAK_HERE;
4000         // Expand vec.
4001         // Check vec <2 items> QVector<bool>.
4002         // Check vec.0 true bool.
4003         // Check vec.1 false bool.
4004         // Continue.
4005         dummyStatement(&vec);
4006     }
4007
4008     void testQVectorListInt()
4009     {
4010         QVector<QList<int> > vec;
4011         QVector<QList<int> > *pv = &vec;
4012         BREAK_HERE;
4013         // CheckType pv QVector<QList<int>>.
4014         // Check vec <0 items> QVector<QList<int>>.
4015         // Continue.
4016         vec.append(QList<int>() << 1);
4017         vec.append(QList<int>() << 2 << 3);
4018         BREAK_HERE;
4019         // Expand pv pv.0 pv.1 vec vec.0 vec.1.
4020         // CheckType pv QVector<QList<int>>.
4021         // Check pv.0 <1 items> QList<int>.
4022         // Check pv.0.0 1 int.
4023         // Check pv.1 <2 items> QList<int>.
4024         // Check pv.1.0 2 int.
4025         // Check pv.1.1 3 int.
4026         // Check vec <2 items> QVector<QList<int>>.
4027         // Check vec.0 <1 items> QList<int>.
4028         // Check vec.0.0 1 int.
4029         // Check vec.1 <2 items> QList<int>.
4030         // Check vec.1.0 2 int.
4031         // Check vec.1.1 3 int.
4032         // Continue.
4033         dummyStatement(pv, &vec);
4034     }
4035
4036     void testQVector()
4037     {
4038         testQVectorIntBig();
4039         testQVectorFoo();
4040         testQVectorFooTypedef();
4041         testQVectorFooStar();
4042         testQVectorBool();
4043         testQVectorListInt();
4044     }
4045
4046 } // namespace qvector
4047
4048
4049 namespace noargs {
4050
4051     class Goo
4052     {
4053     public:
4054        Goo(const QString &str, const int n) : str_(str), n_(n) {}
4055     private:
4056        QString str_;
4057        int n_;
4058     };
4059
4060     typedef QList<Goo> GooList;
4061
4062     void testNoArgumentName(int i, int, int k)
4063     {
4064         // This is not supposed to work with the compiled dumpers.
4065         GooList list;
4066         list.append(Goo("Hello", 1));
4067         list.append(Goo("World", 2));
4068
4069         QList<Goo> list2;
4070         list2.append(Goo("Hello", 1));
4071         list2.append(Goo("World", 2));
4072
4073         BREAK_HERE;
4074         // Expand list list.0 list.1 list2 list2.1.
4075         // Check i 1 int.
4076         // Check k 3 int.
4077         // Check list <2 items> noargs::GooList.
4078         // CheckType list.0 noargs::Goo.
4079         // Check list.0.n_ 1 int.
4080         // Check list.0.str_ "Hello" QString.
4081         // CheckType list.1 noargs::Goo.
4082         // Check list.1.n_ 2 int.
4083         // Check list.1.str_ "World" QString.
4084         // Check list2 <2 items> QList<noargs::Goo>.
4085         // CheckType list2.0 noargs::Goo.
4086         // Check list2.0.n_ 1 int.
4087         // Check list2.0.str_ "Hello" QString.
4088         // CheckType list2.1 noargs::Goo.
4089         // Check list2.1.n_ 2 int.
4090         // Check list2.1.str_ "World" QString.
4091         // Continue.
4092         dummyStatement(&i, &k);
4093     }
4094
4095 } // namespace noargs
4096
4097
4098 void foo() {}
4099 void foo(int) {}
4100 void foo(QList<int>) {}
4101 void foo(QList<QVector<int> >) {}
4102 void foo(QList<QVector<int> *>) {}
4103 void foo(QList<QVector<int *> *>) {}
4104
4105 template <class T>
4106 void foo(QList<QVector<T> *>) {}
4107
4108
4109 namespace namespc {
4110
4111     class MyBase : public QObject
4112     {
4113     public:
4114         MyBase() {}
4115         virtual void doit(int i)
4116         {
4117            n = i;
4118         }
4119     protected:
4120         int n;
4121     };
4122
4123     namespace nested {
4124
4125         class MyFoo : public MyBase
4126         {
4127         public:
4128             MyFoo() {}
4129             virtual void doit(int i)
4130             {
4131                 // Note there's a local 'n' and one in the base class.
4132                 n = i;
4133             }
4134         protected:
4135             int n;
4136         };
4137
4138         class MyBar : public MyFoo
4139         {
4140         public:
4141             virtual void doit(int i)
4142             {
4143                n = i + 1;
4144             }
4145         };
4146
4147         namespace {
4148
4149             class MyAnon : public MyBar
4150             {
4151             public:
4152                 virtual void doit(int i)
4153                 {
4154                    n = i + 3;
4155                 }
4156             };
4157
4158             namespace baz {
4159
4160                 class MyBaz : public MyAnon
4161                 {
4162                 public:
4163                     virtual void doit(int i)
4164                     {
4165                        n = i + 5;
4166                     }
4167                 };
4168
4169             } // namespace baz
4170
4171         } // namespace anon
4172
4173     } // namespace nested
4174
4175     void testNamespace()
4176     {
4177         // This checks whether classes with "special" names are
4178         // properly displayed.
4179         using namespace nested;
4180         MyFoo foo;
4181         MyBar bar;
4182         MyAnon anon;
4183         baz::MyBaz baz;
4184         BREAK_HERE;
4185         // CheckType anon namespc::nested::(anonymous namespace)::MyAnon.
4186         // CheckType bar namespc::nested::MyBar.
4187         // CheckType baz namespc::nested::(anonymous namespace)::baz::MyBaz.
4188         // CheckType foo namespc::nested::MyFoo.
4189         // Continue.
4190         // step into the doit() functions
4191         baz.doit(1);
4192         anon.doit(1);
4193         foo.doit(1);
4194         bar.doit(1);
4195         dummyStatement();
4196     }
4197
4198 } // namespace namespc
4199
4200
4201
4202 class Z : public QObject
4203 {
4204 public:
4205     Z() {
4206         f = new Foo();
4207         i = 0;
4208         i = 1;
4209         i = 2;
4210         i = 3;
4211     }
4212     int i;
4213     Foo *f;
4214 };
4215
4216 void testMemoryView()
4217 {
4218     int a[20];
4219     for (int i = 0; i != 20; ++i)
4220         a[i] = i;
4221     dummyStatement(&a);
4222 }
4223
4224 QString fooxx()
4225 {
4226     return "bababa";
4227 }
4228
4229
4230 namespace basic {
4231
4232     // This tests display of basic types.
4233
4234     void testArray1()
4235     {
4236         double d[3][3];
4237         for (int i = 0; i != 3; ++i)
4238             for (int j = 0; j != 3; ++j)
4239                 d[i][j] = i + j;
4240         BREAK_HERE;
4241         // Expand d d.0.
4242         // CheckType d double [3][3].
4243         // CheckType d.0 double [3].
4244         // Check d.0.0 0 double.
4245         // Check d.0.2 2 double.
4246         // CheckType d.2 double [3].
4247         // Continue.
4248         dummyStatement(&d);
4249     }
4250
4251     void testArray2()
4252     {
4253         char c[20];
4254         c[0] = 'a';
4255         c[1] = 'b';
4256         c[2] = 'c';
4257         c[3] = 'd';
4258         BREAK_HERE;
4259         // Expand c.
4260         // CheckType c char [20].
4261         // Check c.0 97 'a' char.
4262         // Check c.3 100 'd' char.
4263         // Continue.
4264         dummyStatement(&c);
4265     }
4266
4267     void testArray3()
4268     {
4269         QString s[20];
4270         s[0] = "a";
4271         s[1] = "b";
4272         s[2] = "c";
4273         s[3] = "d";
4274         BREAK_HERE;
4275         // Expand s.
4276         // CheckType s QString [20].
4277         // Check s.0 "a" QString.
4278         // Check s.3 "d" QString.
4279         // Check s.4 "" QString.
4280         // Check s.19 "" QString.
4281         // Continue.
4282         dummyStatement(&s);
4283     }
4284
4285     void testArray4()
4286     {
4287         QByteArray b[20];
4288         b[0] = "a";
4289         b[1] = "b";
4290         b[2] = "c";
4291         b[3] = "d";
4292         BREAK_HERE;
4293         // Expand b.
4294         // CheckType b QByteArray [20].
4295         // Check b.0 "a" QByteArray.
4296         // Check b.3 "d" QByteArray.
4297         // Check b.4 "" QByteArray.
4298         // Check b.19 "" QByteArray.
4299         // Continue.
4300         dummyStatement(&b);
4301     }
4302
4303     void testArray5()
4304     {
4305         Foo foo[10];
4306         //for (int i = 0; i != sizeof(foo)/sizeof(foo[0]); ++i) {
4307         for (int i = 0; i < 5; ++i) {
4308             foo[i].a = i;
4309             foo[i].doit();
4310         }
4311         BREAK_HERE;
4312         // Expand foo.
4313         // CheckType foo Foo [10].
4314         // CheckType foo.0 Foo.
4315         // CheckType foo.9 Foo.
4316         // Continue.
4317         dummyStatement(&foo);
4318     }
4319
4320     // https://bugreports.qt-project.org/browse/QTCREATORBUG-5326
4321
4322     void testChar()
4323     {
4324         char s[6];
4325         s[0] = 0;
4326         BREAK_HERE;
4327         // Expand s.
4328         // CheckType s char [6].
4329         // Check s.0 0 '\0' char.
4330         // Continue.
4331
4332         // Manual: Open pinnable tooltip.
4333         // Manual: Step over.
4334         // Manual: Check that display and tooltip look sane.
4335         strcat(s,"\"");
4336         strcat(s,"\"");
4337         strcat(s,"a");
4338         strcat(s,"b");
4339         strcat(s,"\"");
4340         // Manual: Close tooltip.
4341         dummyStatement(&s);
4342     }
4343
4344     static char buf[20] = { 0 };
4345
4346     void testCharStar()
4347     {
4348         char *s = buf;
4349         BREAK_HERE;
4350         // Expand s.
4351         // CheckType s char *.
4352         // Continue.
4353
4354         // Manual: Open pinnable tooltip.
4355         // Manual: Step over.
4356         // Manual: Check that display and tooltip look sane.
4357         s = strcat(s,"\"");
4358         s = strcat(s,"\"");
4359         s = strcat(s,"a");
4360         s = strcat(s,"b");
4361         s = strcat(s,"\"");
4362         // Close tooltip.
4363         dummyStatement(&s);
4364     }
4365
4366     struct S
4367     {
4368         uint x : 1;
4369         uint y : 1;
4370         bool c : 1;
4371         bool b;
4372         float f;
4373         double d;
4374         qreal q;
4375         int i;
4376     };
4377
4378     void testBitfields()
4379     {
4380         // This checks whether bitfields are properly displayed
4381         S s;
4382         BREAK_HERE;
4383         // Expand s.
4384         // CheckType s basic::S.
4385         // CheckType s.b bool.
4386         // CheckType s.c bool.
4387         // CheckType s.d double.
4388         // CheckType s.f float.
4389         // CheckType s.i int.
4390         // CheckType s.q qreal.
4391         // CheckType s.x uint.
4392         // CheckType s.y uint.
4393         // Continue.
4394         s.i = 0;
4395         dummyStatement(&s);
4396     }
4397
4398     struct Function
4399     {
4400         Function(QByteArray var, QByteArray f, double min, double max)
4401           : var(var), f(f), min(min), max(max) {}
4402         QByteArray var;
4403         QByteArray f;
4404         double min;
4405         double max;
4406     };
4407
4408     void testFunction()
4409     {
4410         // In order to use this, switch on the 'qDump__Function' in dumper.py
4411         Function func("x", "sin(x)", 0, 1);
4412         BREAK_HERE;
4413         // Expand func.
4414         // CheckType func basic::Function.
4415         // Check func.f "sin(x)" QByteArray.
4416         // Check func.max 1 double.
4417         // Check func.min 0 double.
4418         // Check func.var "x" QByteArray.
4419         // Continue.
4420         func.max = 10;
4421         func.f = "cos(x)";
4422         func.max = 4;
4423         func.max = 5;
4424         func.max = 6;
4425         func.max = 7;
4426         BREAK_HERE;
4427         // Expand func.
4428         // CheckType func basic::Function.
4429         // Check func.f "cos(x)" QByteArray.
4430         // Check func.max 7 double.
4431         // Continue.
4432         dummyStatement(&func);
4433     }
4434
4435     struct Color
4436     {
4437         int r,g,b,a;
4438         Color() { r = 1, g = 2, b = 3, a = 4; }
4439     };
4440
4441     void testAlphabeticSorting()
4442     {
4443         // This checks whether alphabetic sorting of structure
4444         // members work.
4445         Color c;
4446         BREAK_HERE;
4447         // Expand c.
4448         // CheckType c basic::Color.
4449         // Check c.a 4 int.
4450         // Check c.b 3 int.
4451         // Check c.g 2 int.
4452         // Check c.r 1 int.
4453         // Continue.
4454
4455         // Manual: Toogle "Sort Member Alphabetically" in context menu
4456         // Manual: of "Locals and Expressions" view.
4457         // Manual: Check that order of displayed members changes.
4458         dummyStatement(&c);
4459     }
4460
4461     namespace ns {
4462         typedef unsigned long long vl;
4463         typedef vl verylong;
4464     }
4465
4466     void testTypedef()
4467     {
4468         typedef quint32 myType1;
4469         typedef unsigned int myType2;
4470         myType1 t1 = 0;
4471         myType2 t2 = 0;
4472         ns::vl j = 1000;
4473         ns::verylong k = 1000;
4474         BREAK_HERE;
4475         // Check j 1000 basic::ns::vl.
4476         // Check k 1000 basic::ns::verylong.
4477         // Check t1 0 basic::myType1.
4478         // Check t2 0 basic::myType2.
4479         // Continue.
4480         dummyStatement(&j, &k, &t1, &t2);
4481     }
4482
4483     void testStruct()
4484     {
4485         Foo f(2);
4486         f.doit();
4487         f.doit();
4488         f.doit();
4489         BREAK_HERE;
4490         // Expand f.
4491         // CheckType f Foo.
4492         // Check f.a 5 int.
4493         // Check f.b 2 int.
4494         // Continue.
4495         dummyStatement(&f);
4496     }
4497
4498     void testUnion()
4499     {
4500         union U
4501         {
4502           int a;
4503           int b;
4504         } u;
4505         BREAK_HERE;
4506         // Expand u.
4507         // CheckType u basic::U.
4508         // CheckType u.a int.
4509         // CheckType u.b int.
4510         // Continue.
4511         dummyStatement(&u);
4512     }
4513
4514     void testUninitialized()
4515     {
4516         // This tests the display of uninitialized data.
4517
4518         BREAK_UNINITIALIZED_HERE;
4519         // Check hii <not accessible> QHash<int, int>.
4520         // Check hss <not accessible> QHash<QString, QString>.
4521         // Check li <not accessible> QList<int>.
4522         // CheckType mii <not accessible> QMap<int, int>.
4523         // Check mss <not accessible> QMap<QString, QString>.
4524         // Check s <not accessible> QString.
4525         // Check si <not accessible> QStack<int>.
4526         // Check sl <not accessible> QStringList.
4527         // Check sli <not accessible> std::list<int>.
4528         // CheckType smii std::map<int, int>.
4529         // CheckType smss std::map<std::string, std::string>.
4530         // CheckType ss std::string.
4531         // Check ssi <not accessible> std::stack<int>.
4532         // Check ssl <not accessible> std::list<std::string>.
4533         // CheckType svi std::vector<int>.
4534         // Check vi <not accessible> QVector<int>.
4535         // Continue.
4536
4537         // Manual: Note: All values should be <uninitialized> or random data.
4538         // Manual: Check that nothing bad happens if items with random data
4539         // Manual: are expanded.
4540         QString s;
4541         QStringList sl;
4542         QMap<int, int> mii;
4543         QMap<QString, QString> mss;
4544         QHash<int, int> hii;
4545         QHash<QString, QString> hss;
4546         QList<int> li;
4547         QVector<int> vi;
4548         QStack<int> si;
4549
4550         std::string ss;
4551         std::map<int, int> smii;
4552         std::map<std::string, std::string> smss;
4553         std::list<int> sli;
4554         std::list<std::string> ssl;
4555         std::vector<int> svi;
4556         std::stack<int> ssi;
4557
4558         dummyStatement(&s, &sl, &mii, &mss, &hii, &hss, &si, &vi, &li,
4559                        &ss, &smii, &smss, &sli, &svi, &ssi, &ssl);
4560     }
4561
4562     void testTypeFormats()
4563     {
4564         // These tests should result in properly displayed umlauts in the
4565         // Locals and Expressions view. It is only support on gdb with Python.
4566
4567         const char *s = "aöa";
4568         const wchar_t *w = L"aöa";
4569         QString u;
4570         BREAK_HERE;
4571         // Expand s.
4572         // CheckType s char *.
4573         // Skip Check s.*s 97 'a' char.
4574         // Check u "" QString.
4575         // CheckType w wchar_t *.
4576         // Continue.
4577
4578         // All: Select UTF-8 in "Change Format for Type" in L&W context menu.
4579         // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu.
4580         // Other: Select UCS-6 in "Change Format for Type" in L&W context menu.
4581
4582         if (sizeof(wchar_t) == 4)
4583             u = QString::fromUcs4((uint *)w);
4584         else
4585             u = QString::fromUtf16((ushort *)w);
4586
4587         // Make sure to undo "Change Format".
4588         dummyStatement(s, w);
4589     }
4590
4591     typedef void *VoidPtr;
4592     typedef const void *CVoidPtr;
4593
4594     struct A
4595     {
4596         A() : test(7) {}
4597         int test;
4598         void doSomething(CVoidPtr cp) const;
4599     };
4600
4601     void A::doSomething(CVoidPtr cp) const
4602     {
4603         BREAK_HERE;
4604         // CheckType cp basic::CVoidPtr.
4605         // Continue.
4606         dummyStatement(&cp);
4607     }
4608
4609     void testPointer()
4610     {
4611         Foo *f = new Foo();
4612         BREAK_HERE;
4613         // Expand f.
4614         // CheckType f Foo.
4615         // Check f.a 0 int.
4616         // Check f.b 5 int.
4617         // Continue.
4618         dummyStatement(f);
4619     }
4620
4621     void testPointerTypedef()
4622     {
4623         A a;
4624         VoidPtr p = &a;
4625         CVoidPtr cp = &a;
4626         BREAK_HERE;
4627         // CheckType a basic::A.
4628         // CheckType cp basic::CVoidPtr.
4629         // CheckType p basic::VoidPtr.
4630         // Continue.
4631         a.doSomething(cp);
4632         dummyStatement(&a, &p);
4633     }
4634
4635     void testStringWithNewline()
4636     {
4637         QString hallo = "hallo\nwelt";
4638         BREAK_HERE;
4639         // Check hallo "hallo\nwelt" QString.
4640         // Continue.
4641
4642         // Check that string is properly displayed.
4643         dummyStatement(&hallo);
4644     }
4645
4646     void testMemoryView()
4647     {
4648         int a[20];
4649         BREAK_HERE;
4650         // CheckType a int [20].
4651         // Continue.
4652
4653         // Select "Open Memory View" from Locals and Expressions
4654         //    context menu for item 'a'.
4655         // Step several times.
4656         // Check the contents of the memory view updates.
4657         for (int i = 0; i != 20; ++i)
4658             a[i] = i;
4659         dummyStatement(&a);
4660     }
4661
4662     void testColoredMemoryView()
4663     {
4664         int i = 42;
4665         double d = 23;
4666         QString s = "Foo";
4667         BREAK_HERE;
4668         // Check d 23 double.
4669         // Check i 42 int.
4670         // Check s "Foo" QString.
4671         // Continue.
4672
4673         // Select "Open Memory View" from Locals and Expressions
4674         //    context menu for item 'd'.
4675         // Check that the opened memory view contains coloured items
4676         //    for 'i', 'd', and 's'.
4677         dummyStatement(&i, &d, &s);
4678     }
4679
4680     void testReference1()
4681     {
4682         int a = 43;
4683         const int &b = a;
4684         typedef int &Ref;
4685         const int c = 44;
4686         const Ref d = a;
4687         BREAK_HERE;
4688         // Check a 43 int.
4689         // Check b 43 int.
4690         // Check c 44 int.
4691         // Check d 43 basic::Ref.
4692         // Continue.
4693         dummyStatement(&a, &b, &c, &d);
4694     }
4695
4696     void testReference2()
4697     {
4698         QString a = "hello";
4699         const QString &b = fooxx();
4700         typedef QString &Ref;
4701         const QString c = "world";
4702         const Ref d = a;
4703         BREAK_HERE;
4704         // Check a "hello" QString.
4705         // Check b "bababa" QString.
4706         // Check c "world" QString.
4707         // Check d "hello" basic::Ref.
4708         // Continue.
4709         dummyStatement(&a, &b, &c, &d);
4710     }
4711
4712     void testReference3(const QString &a)
4713     {
4714         const QString &b = a;
4715         typedef QString &Ref;
4716         const Ref d = const_cast<Ref>(a);
4717         BREAK_HERE;
4718         // Check a "hello" QString.
4719         // Check b "hello" QString.
4720         // Check d "hello" basic::Ref.
4721         // Continue.
4722         dummyStatement(&a, &b, &d);
4723     }
4724
4725     void testLongEvaluation1()
4726     {
4727         QDateTime time = QDateTime::currentDateTime();
4728         const int N = 10000;
4729         QDateTime bigv[N];
4730         for (int i = 0; i < 10000; ++i) {
4731             bigv[i] = time;
4732             time = time.addDays(1);
4733         }
4734         BREAK_HERE;
4735         // Expand bigv.
4736         // Check N 10000 int.
4737         // CheckType bigv QDateTime [10000].
4738         // CheckType bigv.0 QDateTime.
4739         // CheckType bigv.9999 QDateTime.
4740         // CheckType time QDateTime.
4741         // Continue.
4742         // Note: This is expected to _not_ take up to a minute.
4743         dummyStatement(&bigv);
4744     }
4745
4746     void testLongEvaluation2()
4747     {
4748         const int N = 10000;
4749         int bigv[N];
4750         for (int i = 0; i < 10000; ++i)
4751             bigv[i] = i;
4752         BREAK_HERE;
4753         // Expand bigv.
4754         // Check N 10000 int.
4755         // CheckType bigv int [10000].
4756         // Check bigv.0 0 int.
4757         // Check bigv.9999 9999 int.
4758         // Continue.
4759         // Note: This is expected to take up to a minute.
4760         dummyStatement(&bigv);
4761     }
4762
4763     void testFork()
4764     {
4765         QProcess proc;
4766         proc.start("/bin/ls");
4767         proc.waitForFinished();
4768         QByteArray ba = proc.readAllStandardError();
4769         ba.append('x');
4770         BREAK_HERE;
4771         // Check ba "x" QByteArray.
4772         // Check proc "" QProcess.
4773         // Continue.
4774
4775         // Check there is some contents in ba. Error message is expected.
4776         dummyStatement(&ba);
4777     }
4778
4779     void testFunctionPointerHelper() {}
4780
4781     void testFunctionPointer()
4782     {
4783         typedef void (*func_t)();
4784         func_t f2 = testFunctionPointerHelper;
4785         BREAK_HERE;
4786         // CheckType f2 basic::func_t.
4787         // Continue.
4788
4789         // Check there's a valid display for f2.
4790         dummyStatement(&f2);
4791     }
4792
4793     void testPassByReferenceHelper(Foo &f)
4794     {
4795         BREAK_HERE;
4796         // Expand f.
4797         // CheckType f Foo.
4798         // Check f.a 12 int.
4799         // Continue.
4800         ++f.a;
4801         BREAK_HERE;
4802         // Expand f.
4803         // CheckType f Foo.
4804         // Check f.a 13 int.
4805         // Continue.
4806     }
4807
4808     void testPassByReference()
4809     {
4810         Foo f(12);
4811         testPassByReferenceHelper(f);
4812         dummyStatement(&f);
4813     }
4814
4815     void testBigInt()
4816     {
4817         qint64 a = Q_INT64_C(0xF020304050607080);
4818         quint64 b = Q_UINT64_C(0xF020304050607080);
4819         quint64 c = std::numeric_limits<quint64>::max() - quint64(1);
4820         BREAK_HERE;
4821         // Check a -1143861252567568256 qint64.
4822         // Check b -1143861252567568256 quint64.
4823         // Check c -2 quint64.
4824         // Continue.
4825         dummyStatement(&a, &b, &c);
4826     }
4827
4828     void testHidden()
4829     {
4830         int  n = 1;
4831         n = 2;
4832         BREAK_HERE;
4833         // Check n 2 int.
4834         // Continue.
4835         n = 3;
4836         BREAK_HERE;
4837         // Check n 3 int.
4838         // Continue.
4839         {
4840             QString n = "2";
4841             BREAK_HERE;
4842             // Check n "2" QString.
4843             // Check n@1 3 int.
4844             // Continue.
4845             n = "3";
4846             BREAK_HERE;
4847             // Check n "3" QString.
4848             // Check n@1 3 int.
4849             // Continue.
4850             {
4851                 double n = 3.5;
4852                 BREAK_HERE;
4853                 // Check n 3.5 double.
4854                 // Check n@1 "3" QString.
4855                 // Check n@2 3 int.
4856                 // Continue.
4857                 ++n;
4858                 BREAK_HERE;
4859                 // Check n 4.5 double.
4860                 // Check n@1 "3" QString.
4861                 // Check n@2 3 int.
4862                 // Continue.
4863                 dummyStatement(&n);
4864             }
4865             BREAK_HERE;
4866             // Check n "3" QString.
4867             // Check n@1 3 int.
4868             // Continue.
4869             n = "3";
4870             n = "4";
4871             BREAK_HERE;
4872             // Check n "4" QString.
4873             // Check n@1 3 int.
4874             // Continue.
4875             dummyStatement(&n);
4876         }
4877         ++n;
4878         dummyStatement(&n);
4879     }
4880
4881     int testReturnInt()
4882     {
4883         return 1;
4884     }
4885
4886     bool testReturnBool()
4887     {
4888         return true;
4889     }
4890
4891     QString testReturnQString()
4892     {
4893         return "string";
4894     }
4895
4896     void testReturn()
4897     {
4898         bool b = testReturnBool();
4899         BREAK_HERE;
4900         // Check b true bool.
4901         // Continue.
4902         int i = testReturnInt();
4903         BREAK_HERE;
4904         // Check i 1 int.
4905         // Continue.
4906         QString s = testReturnQString();
4907         BREAK_HERE;
4908         // Check s "string" QString.
4909         // Continue.
4910         dummyStatement(&i, &b, &s);
4911     }
4912
4913     void testBasic()
4914     {
4915         testReference1();
4916         testReference2();
4917         testReference3("hello");
4918         testReturn();
4919         testArray1();
4920         testArray2();
4921         testArray3();
4922         testArray4();
4923         testArray5();
4924         testChar();
4925         testCharStar();
4926         testBitfields();
4927         testFunction();
4928         testAlphabeticSorting();
4929         testTypedef();
4930         testPointer();
4931         testPointerTypedef();
4932         testStruct();
4933         testUnion();
4934         testUninitialized();
4935         testTypeFormats();
4936         testStringWithNewline();
4937         testMemoryView();
4938         testColoredMemoryView();
4939         testLongEvaluation1();
4940         testLongEvaluation2();
4941         testFork();
4942         testFunctionPointer();
4943         testPassByReference();
4944         testBigInt();
4945         testHidden();
4946     }
4947
4948 } // namespace basic
4949
4950
4951 namespace io {
4952
4953     void testWCout()
4954     {
4955         using namespace std;
4956         wstring x = L"xxxxx";
4957         wstring::iterator i = x.begin();
4958         // Break here.
4959         // Step.
4960         while (i != x.end()) {
4961             wcout << *i;
4962             i++;
4963         }
4964         wcout.flush();
4965         string y = "yyyyy";
4966         string::iterator j = y.begin();
4967         while (j != y.end()) {
4968             cout << *j;
4969             j++;
4970         }
4971         cout.flush();
4972     }
4973
4974     void testWCout0()
4975     {
4976         // Mixing cout and wcout does not work with gcc.
4977         // See http://gcc.gnu.org/ml/gcc-bugs/2006-05/msg01193.html
4978         // which also says "you can obtain something close to your
4979         // expectations by calling std::ios::sync_with_stdio(false);
4980         // at the beginning of your program."
4981
4982         using namespace std;
4983         //std::ios::sync_with_stdio(false);
4984         // Break here.
4985         // Step.
4986         wcout << L"WWWWWW" << endl;
4987         wcerr << L"YYYYYY" << endl;
4988         cout << "CCCCCC" << endl;
4989         cerr << "EEEEEE" << endl;
4990         wcout << L"WWWWWW" << endl;
4991         wcerr << L"YYYYYY" << endl;
4992         cout << "CCCCCC" << endl;
4993         cerr << "EEEEEE" << endl;
4994         wcout << L"WWWWWW" << endl;
4995         wcerr << L"YYYYYY" << endl;
4996         cout << "CCCCCC" << endl;
4997         cerr << "EEEEEE" << endl;
4998     }
4999
5000     void testOutput()
5001     {
5002         qDebug() << "qDebug() 1";
5003         qDebug() << "qDebug() 2";
5004         qDebug() << "qDebug() 3";
5005         qDebug() << "qDebug <foo & bar>";
5006
5007         std::cout << "std::cout @@ 1" << std::endl;
5008         std::cout << "std::cout @@ 2\n";
5009         std::cout << "std::cout @@ 3" << std::endl;
5010         std::cout << "std::cout <foo & bar>\n";
5011
5012         std::cerr << "std::cerr 1\n";
5013         std::cerr << "std::cerr 2\n";
5014         std::cerr << "std::cerr 3\n";
5015         std::cerr << "std::cerr <foo & bar>\n";
5016     }
5017
5018     void testInput()
5019     {
5020         // This works only when "Run in terminal" is selected
5021         // in the Run Configuration.
5022         int i;
5023         std::cin >> i;
5024         int j;
5025         std::cin >> j;
5026     }
5027
5028     void testIO()
5029     {
5030         testOutput();
5031         //testInput();
5032         //testWCout();
5033         //testWCout0();
5034     }
5035
5036 } // namespace io
5037
5038
5039 namespace sse {
5040
5041     void testSSE()
5042     {
5043     #ifdef __SSE__
5044         float a[4];
5045         float b[4];
5046         int i;
5047         for (i = 0; i < 4; i++) {
5048             a[i] = 2 * i;
5049             b[i] = 2 * i;
5050         }
5051         __m128 sseA, sseB;
5052         sseA = _mm_loadu_ps(a);
5053         sseB = _mm_loadu_ps(b);
5054         BREAK_HERE;
5055         // Expand a b.
5056         // CheckType sseA __m128.
5057         // CheckType sseB __m128.
5058         // Continue.
5059         dummyStatement(&i, &sseA, &sseB);
5060     #endif
5061     }
5062
5063 } // namespace sse
5064
5065
5066 namespace qscript {
5067
5068     void testQScript()
5069     {
5070     #if USE_SCRIPTLIB
5071         BREAK_UNINITIALIZED_HERE;
5072         QScriptEngine engine;
5073         QDateTime date = QDateTime::currentDateTime();
5074         QScriptValue s;
5075
5076         BREAK_HERE;
5077         // Check engine "" QScriptEngine.
5078         // Check s (invalid) QScriptValue.
5079         // Check x1 <not accessible> QString.
5080         // Continue.
5081         s = QScriptValue(33);
5082         int x = s.toInt32();
5083
5084         s = QScriptValue(QString("34"));
5085         QString x1 = s.toString();
5086
5087         s = engine.newVariant(QVariant(43));
5088         QVariant v = s.toVariant();
5089
5090         s = engine.newVariant(QVariant(43.0));
5091         s = engine.newVariant(QVariant(QString("sss")));
5092         s = engine.newDate(date);
5093         date = s.toDateTime();
5094         s.setProperty("a", QScriptValue());
5095         QScriptValue d = s.data();
5096         BREAK_HERE;
5097         // Check d (invalid) QScriptValue.
5098         // Check v 43 QVariant (int).
5099         // Check x 33 int.
5100         // Check x1 "34" QString.
5101         // Continue.
5102         dummyStatement(&x1, &v, &s, &d, &x);
5103     #else
5104         dummyStatement();
5105     #endif
5106     }
5107
5108 } // namespace script
5109
5110
5111 namespace boost {
5112
5113     #if USE_BOOST
5114     void testBoostOptional1()
5115     {
5116         boost::optional<int> i;
5117         BREAK_HERE;
5118         // Check i <uninitialized> boost::optional<int>.
5119         // Continue.
5120         i = 1;
5121         BREAK_HERE;
5122         // Check i 1 boost::optional<int>.
5123         // Continue.
5124         dummyStatement(&i);
5125     }
5126
5127     void testBoostOptional2()
5128     {
5129         boost::optional<QStringList> sl;
5130         BREAK_HERE;
5131         // Check sl <uninitialized> boost::optional<QStringList>.
5132         // Continue.
5133         sl = (QStringList() << "xxx" << "yyy");
5134         sl.get().append("zzz");
5135         BREAK_HERE;
5136         // Check sl <3 items> boost::optional<QStringList>.
5137         // Continue.
5138         dummyStatement(&sl);
5139     }
5140
5141     void testBoostSharedPtr()
5142     {
5143         boost::shared_ptr<int> s;
5144         boost::shared_ptr<int> i(new int(43));
5145         boost::shared_ptr<int> j = i;
5146         boost::shared_ptr<QStringList> sl(new QStringList(QStringList() << "HUH!"));
5147         BREAK_HERE;
5148         // Check s  boost::shared_ptr<int>.
5149         // Check i 43 boost::shared_ptr<int>.
5150         // Check j 43 boost::shared_ptr<int>.
5151         // Check sl <1 item> boost::shared_ptr<QStringList>.
5152         // Continue.
5153         dummyStatement(&s, &j, &sl);
5154     }
5155
5156     void testBoostGregorianDate()
5157     {
5158         using namespace boost;
5159         using namespace gregorian;
5160         date d(2005, Nov, 29);
5161         BREAK_HERE;
5162         // Check d Tue Nov 29 2005 boost::gregorian::date.
5163         // Continue
5164
5165         d += months(1);
5166         BREAK_HERE;
5167         // Check d Thu Dec 29 2005 boost::gregorian::date.
5168         // Continue
5169
5170         d += months(1);
5171         BREAK_HERE;
5172         // Check d Sun Jan 29 2006 boost::gregorian::date.
5173         // Continue
5174
5175         // snap-to-end-of-month behavior kicks in:
5176         d += months(1);
5177         BREAK_HERE;
5178         // Check d Tue Feb 28 2006 boost::gregorian::date.
5179         // Continue.
5180
5181         // Also end of the month (expected in boost)
5182         d += months(1);
5183         BREAK_HERE;
5184         // Check d Fri Mar 31 2006 boost::gregorian::date.
5185         // Continue.
5186
5187         // Not where we started (expected in boost)
5188         d -= months(4);
5189         BREAK_HERE;
5190         // Check d Tue Nov 30 2005 boost::gregorian::date.
5191         // Continue.
5192
5193         dummyStatement(&d);
5194     }
5195
5196     void testBoostPosixTimeTimeDuration()
5197     {
5198         using namespace boost;
5199         using namespace posix_time;
5200         time_duration d1(1, 0, 0);
5201         BREAK_HERE;
5202         // Check d1 01:00:00  boost::posix_time::time_duration.
5203         // Continue.
5204         time_duration d2(0, 1, 0);
5205         BREAK_HERE;
5206         // Check d2 00:01:00  boost::posix_time::time_duration.
5207         // Continue.
5208         time_duration d3(0, 0, 1);
5209         BREAK_HERE;
5210         // Check d3 00:00:01  boost::posix_time::time_duration.
5211         // Continue.
5212         dummyStatement(&d1, &d2, &d3);
5213     }
5214
5215     void testBoostPosixTimePtime()
5216     {
5217         using namespace boost;
5218         using namespace gregorian;
5219         using namespace posix_time;
5220         ptime p1(date(2002, 1, 10), time_duration(1, 0, 0));
5221         BREAK_HERE;
5222         // Check p1 Thu Jan 10 01:00:00 2002  boost::posix_time::ptime.
5223         // Continue.
5224         ptime p2(date(2002, 1, 10), time_duration(0, 0, 0));
5225         BREAK_HERE;
5226         // Check p2 Thu Jan 10 00:00:00 2002  boost::posix_time::ptime.
5227         // Continue.
5228         ptime p3(date(1970, 1, 1), time_duration(0, 0, 0));
5229         BREAK_HERE;
5230         // Check p3 Thu Jan 1 00:00:00 1970  boost::posix_time::ptime.
5231         // Continue.
5232         dummyStatement(&p1, &p2, &p3);
5233     }
5234
5235     void testBoost()
5236     {
5237         testBoostOptional1();
5238         testBoostOptional2();
5239         testBoostSharedPtr();
5240         testBoostPosixTimeTimeDuration();
5241         testBoostPosixTimePtime();
5242         testBoostGregorianDate();
5243     }
5244
5245     #else
5246
5247     void testBoost() {}
5248
5249     #endif
5250
5251 } // namespace boost
5252
5253
5254 namespace mpi {
5255
5256     struct structdata
5257     {
5258         int ints[8];
5259         char chars[32];
5260         double doubles[5];
5261     };
5262
5263     enum type_t { MPI_LB, MPI_INT, MPI_CHAR, MPI_DOUBLE, MPI_UB };
5264
5265     struct tree_entry
5266     {
5267         tree_entry() {}
5268         tree_entry(int l, int o, type_t t)
5269             : blocklength(l), offset(o), type(t)
5270         {}
5271
5272         int blocklength;
5273         int offset;
5274         type_t type;
5275     };
5276
5277     struct tree
5278     {
5279         enum kind_t { STRUCT };
5280
5281         void *base;
5282         kind_t kind;
5283         int count;
5284         tree_entry entries[20];
5285     };
5286
5287     void testMPI()
5288     {
5289         structdata buffer = {
5290             //{MPI_LB},
5291             {0, 1024, 2048, 3072, 4096, 5120, 6144 },
5292             {"message to 1 of 2: hello"},
5293             {0, 3.14, 6.2831853071795862, 9.4247779607693793, 13},
5294             //{MPI_UB}
5295         };
5296
5297         tree x;
5298         x.base = &buffer;
5299         x.kind = tree::STRUCT;
5300         x.count = 5;
5301         x.entries[0] = tree_entry(1, -4, MPI_LB);
5302         x.entries[1] = tree_entry(5,  0, MPI_INT);
5303         x.entries[2] = tree_entry(7, 47, MPI_CHAR);
5304         x.entries[3] = tree_entry(2, 76, MPI_DOUBLE);
5305         x.entries[4] = tree_entry(1, 100, MPI_UB);
5306
5307
5308         int i = x.count;
5309         i = buffer.ints[0];
5310         i = buffer.ints[1];
5311         i = buffer.ints[2];
5312         i = buffer.ints[3];
5313         /*
5314                 gdb) print datatype
5315                 > $3 = {
5316                 >   kind = STRUCT,
5317                 >   count = 5,
5318                 >   entries = {{
5319                 >       blocklength = 1,
5320                 >       offset = -4,
5321                 >       type = MPI_LB
5322                 >     }, {
5323                 >       blocklength = 5,
5324                 >       offset = 0,
5325                 >       type = MPI_INT
5326                 >     }, {
5327                 >       blocklength = 7,
5328                 >       offset = 47,
5329                 >       type = MPI_CHAR
5330                 >     }, {
5331                 >       blocklength = 2,
5332                 >       offset = 76,
5333                 >       type = MPI_DOUBLE
5334                 >     }, {
5335                 >       blocklength = 1,
5336                 >       offset = 100,
5337                 >       type = MPI_UB
5338                 >     }}
5339                 > }
5340         */
5341         dummyStatement(&i);
5342     }
5343
5344 } // namespace mpi
5345
5346
5347 //namespace kr {
5348
5349     // FIXME: put in namespace kr, adjust qdump__KRBase in dumpers/qttypes.py
5350     struct KRBase
5351     {
5352         enum Type { TYPE_A, TYPE_B } type;
5353         KRBase(Type _type) : type(_type) {}
5354     };
5355
5356     struct KRA : KRBase { int x; int y; KRA():KRBase(TYPE_A), x(1), y(32) {} };
5357     struct KRB : KRBase { KRB():KRBase(TYPE_B) {} };
5358
5359 //} // namespace kr
5360
5361
5362 namespace kr {
5363
5364     // Only with python.
5365     // This tests qdump__KRBase in dumpers/qttypes.py which uses
5366     // a static typeflag to dispatch to subclasses.
5367
5368     void testKR()
5369     {
5370         KRBase *ptr1 = new KRA;
5371         KRBase *ptr2 = new KRB;
5372         ptr2 = new KRB;
5373         BREAK_HERE;
5374         // Expand ptr1 ptr2.
5375         // CheckType ptr1 KRBase.
5376         // Check ptr1.type KRBase::TYPE_A (0) KRBase::Type.
5377         // CheckType ptr2 KRBase.
5378         // Check ptr2.type KRBase::TYPE_B (1) KRBase::Type.
5379         // Continue.
5380         dummyStatement(&ptr1, &ptr2);
5381     }
5382
5383 } // namspace kr
5384
5385
5386 namespace eigen {
5387
5388     void testEigen()
5389     {
5390     #if USE_EIGEN
5391         using namespace Eigen;
5392
5393         Vector3d test = Vector3d::Zero();
5394
5395         Matrix3d myMatrix = Matrix3d::Constant(5);
5396         MatrixXd myDynamicMatrix(30, 10);
5397
5398         myDynamicMatrix(0, 0) = 0;
5399         myDynamicMatrix(1, 0) = 1;
5400         myDynamicMatrix(2, 0) = 2;
5401
5402         Matrix<double, 12, 15, ColMajor> colMajorMatrix;
5403         Matrix<double, 12, 15, RowMajor> rowMajorMatrix;
5404
5405         int k = 0;
5406         for (int i = 0; i != 12; ++i) {
5407             for (int j = 0; j != 15; ++j) {
5408                 colMajorMatrix(i, j) = k;
5409                 rowMajorMatrix(i, j) = k;
5410                 ++k;
5411             }
5412         }
5413
5414         BREAK_HERE;
5415
5416         // Continue.
5417         dummyStatement(&colMajorMatrix, &rowMajorMatrix, &test,
5418                        &myMatrix, &myDynamicMatrix);
5419     #endif
5420     }
5421 }
5422
5423
5424 namespace bug842 {
5425
5426     void test842()
5427     {
5428         // https://bugreports.qt-project.org/browse/QTCREATORBUG-842
5429         qWarning("Test");
5430         BREAK_HERE;
5431         // Continue.
5432         // Manual: Check that Application Output pane contains string "Test".
5433         dummyStatement();
5434     }
5435
5436 } // namespace bug842
5437
5438
5439 namespace bug3611 {
5440
5441     void test3611()
5442     {
5443         // https://bugreports.qt-project.org/browse/QTCREATORBUG-3611
5444         typedef unsigned char byte;
5445         byte f = '2';
5446         int *x = (int*)&f;
5447         BREAK_HERE;
5448         // Check f 50 bug3611::byte.
5449         // Continue.
5450         // Step.
5451         f += 1;
5452         f += 1;
5453         f += 1;
5454         BREAK_HERE;
5455         // Check f 53 bug3611::byte.
5456         // Continue.
5457         dummyStatement(&f, &x);
5458     }
5459
5460 } // namespace bug3611
5461
5462
5463 namespace bug4019 {
5464
5465     // https://bugreports.qt-project.org/browse/QTCREATORBUG-4019
5466
5467     class A4019
5468     {
5469     public:
5470         A4019() : test(7) {}
5471         int test;
5472         void doSomething() const;
5473     };
5474
5475     void A4019::doSomething() const
5476     {
5477         std::cout << test << std::endl;
5478     }
5479
5480     void test4019()
5481     {
5482         A4019 a;
5483         a.doSomething();
5484     }
5485
5486 } // namespave bug4019
5487
5488
5489 namespace bug4997 {
5490
5491     // https://bugreports.qt-project.org/browse/QTCREATORBUG-4997
5492
5493     void test4997()
5494     {
5495         using namespace std;
5496         // cin.get(); // if commented out, the debugger doesn't stop at the breakpoint
5497         // in the next line on Windows when "Run in Terminal" is used.^
5498         dummyStatement();
5499     }
5500 }
5501
5502
5503 namespace bug4904 {
5504
5505     // https://bugreports.qt-project.org/browse/QTCREATORBUG-4904
5506
5507     struct CustomStruct {
5508         int id;
5509         double dvalue;
5510     };
5511
5512     void test4904()
5513     {
5514         QMap<int, CustomStruct> map;
5515         CustomStruct cs1;
5516         cs1.id = 1;
5517         cs1.dvalue = 3.14;
5518         CustomStruct cs2 = cs1;
5519         cs2.id = -1;
5520         map.insert(cs1.id, cs1);
5521         map.insert(cs2.id, cs2);
5522         QMap<int, CustomStruct>::iterator it = map.begin();
5523         BREAK_HERE;
5524         // Expand map map.0 map.0.value.
5525         // Check map <2 items> QMap<int, bug4904::CustomStruct>.
5526         // Check map.0   QMapNode<int, bug4904::CustomStruct>.
5527         // Check map.0.key -1 int.
5528         // CheckType map.0.value bug4904::CustomStruct.
5529         // Check map.0.value.dvalue 3.1400000000000001 double.
5530         // Check map.0.value.id -1 int.
5531         // Continue.
5532         dummyStatement(&it);
5533     }
5534
5535 } // namespace bug4904
5536
5537
5538 namespace bug5046 {
5539
5540     // https://bugreports.qt-project.org/browse/QTCREATORBUG-5046
5541
5542     struct Foo { int a, b, c; };
5543
5544     void test5046()
5545     {
5546         Foo f;
5547         f.a = 1;
5548         f.b = 2;
5549         f.c = 3;
5550         f.a = 4;
5551         BREAK_HERE;
5552         // Expand f.
5553         // CheckType f bug5046::Foo.
5554         // Check f.a 4 int.
5555         // Check f.b 2 int.
5556         // Check f.c 3 int.
5557         // Continue.
5558
5559         // Manual: pop up main editor tooltip over 'f'
5560         // Manual: verify that the entry is expandable, and expansion works
5561         dummyStatement(&f);
5562     }
5563
5564 } // namespace bug5046
5565
5566
5567 namespace bug5106 {
5568
5569     // https://bugreports.qt-project.org/browse/QTCREATORBUG-5106
5570
5571     class A5106
5572     {
5573     public:
5574             A5106(int a, int b) : m_a(a), m_b(b) {}
5575             virtual int test() { return 5; }
5576     private:
5577             int m_a, m_b;
5578     };
5579
5580     class B5106 : public A5106
5581     {
5582     public:
5583             B5106(int c, int a, int b) : A5106(a, b), m_c(c) {}
5584             virtual int test() { return 4; BREAK_HERE; }
5585     private:
5586             int m_c;
5587     };
5588
5589     void test5106()
5590     {
5591         B5106 b(1,2,3);
5592         b.test();
5593         b.A5106::test();
5594     }
5595
5596 } // namespace bug5106
5597
5598
5599 namespace bug5184 {
5600
5601     // https://bugreports.qt-project.org/browse/QTCREATORBUG-5184
5602
5603     // Note: The report there shows type field "QUrl &" instead of QUrl.
5604     // It's unclear how this can happen. It should never have been like
5605     // that with a stock 7.2 and any version of Creator.
5606
5607     void helper(const QUrl &url)
5608     {
5609         QNetworkRequest request(url);
5610         QList<QByteArray> raw = request.rawHeaderList();
5611         BREAK_HERE;
5612         // Check raw <0 items> QList<QByteArray>.
5613         // CheckType request QNetworkRequest.
5614         // Check url "http://127.0.0.1/" QUrl.
5615         // Continue.
5616         dummyStatement(&request, &raw);
5617     }
5618
5619     void test5184()
5620     {
5621         QUrl url(QString("http://127.0.0.1/"));
5622         helper(url);
5623     }
5624
5625 } // namespace bug5184
5626
5627
5628 namespace qc42170 {
5629
5630     // http://www.qtcentre.org/threads/42170-How-to-watch-data-of-actual-type-in-debugger
5631
5632     struct Object
5633     {
5634         Object(int id_) : id(id_) {}
5635         virtual ~Object() {}
5636         int id;
5637     };
5638
5639     struct Point : Object
5640     {
5641         Point(double x_, double y_) : Object(1), x(x_), y(y_) {}
5642         double x, y;
5643     };
5644
5645     struct Circle : Point
5646     {
5647         Circle(double x_, double y_, double r_) : Point(x_, y_), r(r_) { id = 2; }
5648         double r;
5649     };
5650
5651     void helper(Object *obj)
5652     {
5653         BREAK_HERE;
5654         // CheckType obj qc42170::Circle.
5655         // Continue.
5656
5657         // Check that obj is shown as a 'Circle' object.
5658         dummyStatement(obj);
5659     }
5660
5661     void test42170()
5662     {
5663         Circle *circle = new Circle(1.5, -2.5, 3.0);
5664         Object *obj = circle;
5665         helper(circle);
5666         helper(obj);
5667     }
5668
5669 } // namespace qc42170
5670
5671
5672 namespace bug5799 {
5673
5674     // https://bugreports.qt-project.org/browse/QTCREATORBUG-5799
5675
5676     typedef struct { int m1; int m2; } S1;
5677
5678     struct S2 : S1 { };
5679
5680     typedef struct S3 { int m1; int m2; } S3;
5681
5682     struct S4 : S3 { };
5683
5684     void test5799()
5685     {
5686         S2 s2;
5687         s2.m1 = 5;
5688         S4 s4;
5689         s4.m1 = 5;
5690         S1 a1[10];
5691         typedef S1 Array[10];
5692         Array a2;
5693         BREAK_HERE;
5694         // Expand s2 s2.@1 s4 s4.@1
5695         // CheckType a1 bug5799::S1 [10].
5696         // CheckType a2 bug5799::Array.
5697         // CheckType s2 bug5799::S2.
5698         // CheckType s2.@1 bug5799::S1.
5699         // Check s2.@1.m1 5 int.
5700         // CheckType s2.@1.m2 int.
5701         // CheckType s4 bug5799::S4.
5702         // CheckType s4.@1 bug5799::S3.
5703         // Check s4.@1.m1 5 int.
5704         // CheckType s4.@1.m2 int.
5705         // Continue.
5706         dummyStatement(&s2, &s4, &a1, &a2);
5707     }
5708
5709 } // namespace bug5799
5710
5711
5712 namespace bug6813 {
5713
5714     // https://bugreports.qt-project.org/browse/QTCREATORBUG-6813
5715     void test6813()
5716     {
5717       int foo = 0;
5718       int *bar = &foo;
5719       //std::cout << "&foo: " << &foo << "; bar: " << bar << "; &bar: " << &bar;
5720       dummyStatement(&foo, &bar);
5721     }
5722
5723 } // namespace bug6813
5724
5725
5726 namespace qc41700 {
5727
5728     // http://www.qtcentre.org/threads/41700-How-to-watch-STL-containers-iterators-during-debugging
5729
5730     void test41700()
5731     {
5732         using namespace std;
5733         typedef map<string, list<string> > map_t;
5734         map_t m;
5735         m["one"].push_back("a");
5736         m["one"].push_back("b");
5737         m["one"].push_back("c");
5738         m["two"].push_back("1");
5739         m["two"].push_back("2");
5740         m["two"].push_back("3");
5741         map_t::const_iterator it = m.begin();
5742         BREAK_HERE;
5743         // Expand m m.0 m.0.second m.1 m.1.second.
5744         // Check m <2 items> qc41700::map_t.
5745         // Check m.0   std::pair<std::string const, std::list<std::string>>.
5746         // Check m.0.first "one" std::string.
5747         // Check m.0.second <3 items> std::list<std::string>.
5748         // Check m.0.second.0 "a" std::string.
5749         // Check m.0.second.1 "b" std::string.
5750         // Check m.0.second.2 "c" std::string.
5751         // Check m.1   std::pair<std::string const, std::list<std::string>>.
5752         // Check m.1.first "two" std::string.
5753         // Check m.1.second <3 items> std::list<std::string>.
5754         // Check m.1.second.0 "1" std::string.
5755         // Check m.1.second.1 "2" std::string.
5756         // Check m.1.second.2 "3" std::string.
5757         // Continue.
5758         dummyStatement(&it);
5759     }
5760
5761 } // namespace qc41700
5762
5763
5764 namespace cp42895 {
5765
5766     // http://codepaster.europe.nokia.com/?id=42895
5767
5768     void g(int c, int d)
5769     {
5770         qDebug() << c << d;
5771         BREAK_HERE;
5772         // Check c 3 int.
5773         // Check d 4 int.
5774         // Continue.
5775         // Check there are frames for g and f in the stack view.
5776         dummyStatement(&c, &d);
5777     }
5778
5779     void f(int a, int b)
5780     {
5781         g(a, b);
5782     }
5783
5784     void test42895()
5785     {
5786         f(3, 4);
5787     }
5788
5789 } // namespace cp
5790
5791
5792 namespace bug6465 {
5793
5794     // https://bugreports.qt-project.org/browse/QTCREATORBUG-6465
5795
5796     void test6465()
5797     {
5798         typedef char Foo[20];
5799         Foo foo = "foo";
5800         char bar[20] = "baz";
5801         // BREAK HERE
5802         dummyStatement(&foo, &bar);
5803     }
5804
5805 } // namespace bug6465
5806
5807
5808 namespace bug6857 {
5809
5810     class MyFile : public QFile
5811     {
5812     public:
5813         MyFile(const QString &fileName)
5814             : QFile(fileName) {}
5815     };
5816
5817     void test6857()
5818     {
5819         MyFile file("/tmp/tt");
5820         file.setObjectName("A file");
5821         BREAK_HERE;
5822         // Expand file.
5823         // Check file "A file" bug6857::MyFile.
5824         // Check file.@1 "/tmp/tt" QFile.
5825         // Continue.
5826         dummyStatement(&file);
5827     }
5828 }
5829
5830
5831 namespace bug6858 {
5832
5833     class MyFile : public QFile
5834     {
5835     public:
5836         MyFile(const QString &fileName)
5837             : QFile(fileName) {}
5838     };
5839
5840     void test6858()
5841     {
5842         MyFile file("/tmp/tt");
5843         file.setObjectName("Another file");
5844         QFile *pfile = &file;
5845         BREAK_HERE;
5846         // Check pfile "Another file" bug6858::MyFile.
5847         // Check pfile.@1 "/tmp/tt" QFile.
5848         // Continue.
5849         dummyStatement(&file, pfile);
5850     }
5851 }
5852
5853
5854 namespace bug6863 {
5855
5856     class MyObject : public QObject
5857     {
5858         Q_OBJECT
5859     public:
5860         MyObject() {}
5861     };
5862
5863     void setProp(QObject *obj)
5864     {
5865         obj->setProperty("foo", "bar");
5866         BREAK_HERE;
5867         // Expand obj.
5868         // Check obj.[QObject].properties <2 items>.
5869         // Continue.
5870         dummyStatement(&obj);
5871     }
5872
5873     void test6863()
5874     {
5875         QFile file("/tmp/tt");
5876         setProp(&file);
5877         MyObject obj;
5878         setProp(&obj);
5879     }
5880
5881 }
5882
5883
5884 namespace bug6933 {
5885
5886     class Base
5887     {
5888     public:
5889         Base() : a(21) {}
5890         virtual ~Base() {}
5891         int a;
5892     };
5893
5894     class Derived : public Base
5895     {
5896     public:
5897         Derived() : b(42) {}
5898         int b;
5899     };
5900
5901     void test6933()
5902     {
5903         Derived d;
5904         Base *b = &d;
5905         BREAK_HERE;
5906         // Expand b b.bug6933::Base
5907         // Check b.[bug6933::Base].[vptr]
5908         // Check b.b 42 int.
5909         // Continue.
5910         dummyStatement(&d, b);
5911     }
5912 }
5913
5914 namespace varargs {
5915
5916     void test(const char *format, ...)
5917     {
5918         va_list arg;
5919         va_start(arg, format);
5920         int i = va_arg(arg, int);
5921         double f = va_arg(arg, double);
5922         va_end(arg);
5923         dummyStatement(&i, &f);
5924     }
5925
5926     void testVaList()
5927     {
5928         test("abc", 1, 2.0);
5929     }
5930
5931 } // namespace varargs
5932
5933
5934 namespace gdb13393 {
5935
5936     struct Base {
5937         Base() : a(1) {}
5938         virtual ~Base() {}  // Enforce type to have RTTI
5939         int a;
5940     };
5941
5942
5943     struct Derived : public Base {
5944         Derived() : b(2) {}
5945         int b;
5946     };
5947
5948     struct S
5949     {
5950         Base *ptr;
5951         const Base *ptrConst;
5952         Base &ref;
5953         const Base &refConst;
5954
5955         S(Derived &d)
5956             : ptr(&d), ptrConst(&d), ref(d), refConst(d)
5957         {}
5958     };
5959
5960     void test13393()
5961     {
5962         Derived d;
5963         S s(d);
5964         Base *ptr = &d;
5965         const Base *ptrConst = &d;
5966         Base &ref = d;
5967         const Base &refConst = d;
5968         Base **ptrToPtr = &ptr;
5969         #if USE_BOOST
5970         boost::shared_ptr<Base> sharedPtr(new Derived());
5971         #else
5972         int sharedPtr = 1;
5973         #endif
5974         BREAK_HERE;
5975         // Expand d ptr ptr.@1 ptrConst ptrToPtr ref refConst s.
5976         // CheckType d gdb13393::Derived.
5977         // CheckType d.@1 gdb13393::Base.
5978         // Check d.b 2 int.
5979         // CheckType ptr gdb13393::Derived.
5980         // CheckType ptr.@1 gdb13393::Base.
5981         // Check ptr.@1.a 1 int.
5982         // CheckType ptrConst gdb13393::Derived.
5983         // CheckType ptrConst.@1 gdb13393::Base.
5984         // Check ptrConst.b 2 int.
5985         // CheckType ptrToPtr gdb13393::Derived.
5986         // CheckType ptrToPtr.[vptr] .
5987         // Check ptrToPtr.@1.a 1 int.
5988         // CheckType ref gdb13393::Derived.
5989         // CheckType ref.[vptr] .
5990         // Check ref.@1.a 1 int.
5991         // CheckType refConst gdb13393::Derived.
5992         // CheckType refConst.[vptr] .
5993         // Check refConst.@1.a 1 int.
5994         // CheckType s gdb13393::S.
5995         // CheckType s.ptr gdb13393::Derived.
5996         // CheckType s.ptrConst gdb13393::Derived.
5997         // CheckType s.ref gdb13393::Derived.
5998         // CheckType s.refConst gdb13393::Derived.
5999         // Check sharedPtr 1 int.
6000         // Continue.
6001         dummyStatement(&d, &s, &ptrToPtr, &sharedPtr, &ptrConst, &refConst, &ref);
6002     }
6003
6004 } // namespace gdb13393
6005
6006
6007 namespace gdb10586 {
6008
6009     // http://sourceware.org/bugzilla/show_bug.cgi?id=10586. fsf/MI errors out
6010     // on -var-list-children on an anonymous union. mac/MI was fixed in 2006.
6011     // The proposed fix has been reported to crash gdb steered from eclipse.
6012     // http://sourceware.org/ml/gdb-patches/2011-12/msg00420.html
6013     // Check we are not harmed by either version.
6014     void testmi()
6015     {
6016         struct test {
6017             struct { int a; float b; };
6018             struct { int c; float d; };
6019         } v = {{1, 2}, {3, 4}};
6020         BREAK_HERE;
6021         // Expand v.
6022         // Check v  gdb10586::test.
6023         // Check v.a 1 int.
6024         // Continue.
6025         dummyStatement(&v);
6026     }
6027
6028     void testeclipse()
6029     {
6030         struct { int x; struct { int a; }; struct { int b; }; } v = {1, {2}, {3}};
6031         struct s { int x, y; } n = {10, 20};
6032         BREAK_HERE;
6033         // Expand v.
6034         // Expand n.
6035         // CheckType v {...}.
6036         // CheckType n gdb10586::s.
6037         // Check v.a 2 int.
6038         // Check v.b 3 int.
6039         // Check v.x 1 int.
6040         // Check n.x 10 int.
6041         // Check n.y 20 int.
6042         // Continue.
6043         dummyStatement(&v, &n);
6044     }
6045
6046     void test10586()
6047     {
6048         testmi();
6049         testeclipse();
6050     }
6051
6052 } // namespace gdb10586
6053
6054
6055 namespace valgrind {
6056
6057     void testLeak()
6058     {
6059         new int[100]; // Leaks intentionally.
6060     }
6061
6062     void testValgrind()
6063     {
6064         testLeak();
6065     }
6066
6067 } // namespace valgrind
6068
6069
6070 namespace sanity {
6071
6072     // A very quick check.
6073     void testSanity()
6074     {
6075         std::string s;
6076         s = "hallo";
6077         s += "hallo";
6078
6079         QVector<int> qv;
6080         qv.push_back(2);
6081
6082         std::vector<int> v;
6083         v.push_back(2);
6084
6085         QStringList list;
6086         list << "aaa" << "bbb" << "cc";
6087
6088         QList<const char *> list2;
6089         list2 << "foo";
6090         list2 << "bar";
6091         list2 << 0;
6092         list2 << "baz";
6093         list2 << 0;
6094
6095         QObject obj;
6096         obj.setObjectName("An Object");
6097
6098         BREAK_HERE;
6099         // Check list <3 items> QStringList
6100         // Check list2 <5 items> QList<char const*>
6101         // Check obj "An Object" QObject
6102         // Check qv <1 items> QVector<int>
6103         // Check s "hallohallo" std::string
6104         // Check v <1 items> std::vector<int>
6105         // Continue
6106
6107         dummyStatement(&s, &qv, &v, &list, &list2, &obj);
6108     }
6109
6110 } // namespace sanity
6111
6112
6113 int main(int argc, char *argv[])
6114 {
6115     QApplication app(argc, argv);
6116
6117     // Notify Creator about auto run intention.
6118     if (USE_AUTORUN)
6119         qWarning("Creator: Switch on magic autorun.");
6120     else
6121         qWarning("Creator: Switch off magic autorun.");
6122
6123     // For a very quick check, step into this one.
6124     sanity::testSanity();
6125
6126     // Check for normal dumpers.
6127     basic::testBasic();
6128     qhostaddress::testQHostAddress();
6129     varargs::testVaList();
6130
6131     formats::testFormats();
6132     breakpoints::testBreakpoints();
6133     peekandpoke::testPeekAndPoke3();
6134     anon::testAnonymous();
6135
6136     itemmodel::testItemModel();
6137     noargs::testNoArgumentName(1, 2, 3);
6138     text::testText();
6139     io::testIO();
6140     catchthrow::testCatchThrow();
6141     plugin::testPlugin();
6142     valgrind::testValgrind();
6143     namespc::testNamespace();
6144     painting::testPainting();
6145
6146     stdarray::testStdArray();
6147     stdcomplex::testStdComplex();
6148     stddeque::testStdDeque();
6149     stdlist::testStdList();
6150     stdhashset::testStdHashSet();
6151     stdmap::testStdMap();
6152     stdset::testStdSet();
6153     stdstack::testStdStack();
6154     stdstream::testStdStream();
6155     stdstring::testStdString();
6156     stdvector::testStdVector();
6157     stdptr::testStdPtr();
6158
6159     qbytearray::testQByteArray();
6160     qdatetime::testDateTime();
6161     qdir::testQDir();
6162     qfileinfo::testQFileInfo();
6163     qhash::testQHash();
6164     qlinkedlist::testQLinkedList();
6165     qlist::testQList();
6166     qlocale::testQLocale();
6167     qmap::testQMap();
6168     qobject::testQObject();
6169     qrect::testGeometry();
6170     qregexp::testQRegExp();
6171     qregion::testQRegion();
6172     qscript::testQScript();
6173     qset::testQSet();
6174     qsharedpointer::testQSharedPointer();
6175     qstack::testQStack();
6176     qstringlist::testQStringList();
6177     qstring::testQString();
6178     qthread::testQThread();
6179     qurl::testQUrl();
6180     qvariant::testQVariant();
6181     qvector::testQVector();
6182     qxml::testQXmlAttributes();
6183
6184     // Third party data types.
6185     boost::testBoost();
6186     eigen::testEigen();
6187     kr::testKR();
6188     mpi::testMPI();
6189     sse::testSSE();
6190
6191     // The following tests are specific to certain bugs.
6192     // They need not to be checked during a normal release check.
6193     cp42895::test42895();
6194     bug5046::test5046();
6195     bug4904::test4904();
6196     qc41700::test41700();
6197     qc42170::test42170();
6198     multibp::testMultiBp();
6199     bug842::test842();
6200     bug3611::test3611();
6201     bug4019::test4019();
6202     bug4997::test4997();
6203     bug5106::test5106();
6204     bug5184::test5184();
6205     bug5799::test5799();
6206     bug6813::test6813();
6207     bug6465::test6465();
6208     bug6857::test6857();
6209     bug6858::test6858();
6210     bug6863::test6863();
6211     bug6933::test6933();
6212     gdb13393::test13393();
6213     gdb10586::test10586();
6214
6215     final::testFinal(&app);
6216
6217     return 0;
6218 }
6219
6220 #include "simple_test_app.moc"