qxmltestlogger.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/testlib/qxmltestlogger.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5namespace QTest {-
6-
7 static const char* xmlMessageType2String(QAbstractTestLogger::MessageTypes type)-
8 {-
9 switch (type) {-
10 case
executed 24 times by 1 test: case QAbstractTestLogger::Warn:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::Warn:
executed 24 times by 1 test: case QAbstractTestLogger::Warn:
Executed by:
  • tst_selftests - unknown status
24
11 return
executed 24 times by 1 test: return "warn";
Executed by:
  • tst_selftests - unknown status
"warn";
executed 24 times by 1 test: return "warn";
Executed by:
  • tst_selftests - unknown status
24
12 case
executed 12 times by 1 test: case QAbstractTestLogger::QSystem:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::QSystem:
executed 12 times by 1 test: case QAbstractTestLogger::QSystem:
Executed by:
  • tst_selftests - unknown status
12
13 return
executed 12 times by 1 test: return "system";
Executed by:
  • tst_selftests - unknown status
"system";
executed 12 times by 1 test: return "system";
Executed by:
  • tst_selftests - unknown status
12
14 case
executed 1077 times by 1 test: case QAbstractTestLogger::QDebug:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::QDebug:
executed 1077 times by 1 test: case QAbstractTestLogger::QDebug:
Executed by:
  • tst_selftests - unknown status
1077
15 return
executed 1077 times by 1 test: return "qdebug";
Executed by:
  • tst_selftests - unknown status
"qdebug";
executed 1077 times by 1 test: return "qdebug";
Executed by:
  • tst_selftests - unknown status
1077
16 case
executed 24 times by 1 test: case QAbstractTestLogger::QInfo:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::QInfo:
executed 24 times by 1 test: case QAbstractTestLogger::QInfo:
Executed by:
  • tst_selftests - unknown status
24
17 return
executed 24 times by 1 test: return "qinfo";
Executed by:
  • tst_selftests - unknown status
"qinfo";
executed 24 times by 1 test: return "qinfo";
Executed by:
  • tst_selftests - unknown status
24
18 case
executed 24048 times by 1 test: case QAbstractTestLogger::QWarning:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::QWarning:
executed 24048 times by 1 test: case QAbstractTestLogger::QWarning:
Executed by:
  • tst_selftests - unknown status
24048
19 return
executed 24048 times by 1 test: return "qwarn";
Executed by:
  • tst_selftests - unknown status
"qwarn";
executed 24048 times by 1 test: return "qwarn";
Executed by:
  • tst_selftests - unknown status
24048
20 case
executed 24 times by 1 test: case QAbstractTestLogger::QFatal:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::QFatal:
executed 24 times by 1 test: case QAbstractTestLogger::QFatal:
Executed by:
  • tst_selftests - unknown status
24
21 return
executed 24 times by 1 test: return "qfatal";
Executed by:
  • tst_selftests - unknown status
"qfatal";
executed 24 times by 1 test: return "qfatal";
Executed by:
  • tst_selftests - unknown status
24
22 case
executed 444 times by 1 test: case QAbstractTestLogger::Skip:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::Skip:
executed 444 times by 1 test: case QAbstractTestLogger::Skip:
Executed by:
  • tst_selftests - unknown status
444
23 return
executed 444 times by 1 test: return "skip";
Executed by:
  • tst_selftests - unknown status
"skip";
executed 444 times by 1 test: return "skip";
Executed by:
  • tst_selftests - unknown status
444
24 case
executed 372 times by 1 test: case QAbstractTestLogger::Info:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::Info:
executed 372 times by 1 test: case QAbstractTestLogger::Info:
Executed by:
  • tst_selftests - unknown status
372
25 return
executed 372 times by 1 test: return "info";
Executed by:
  • tst_selftests - unknown status
"info";
executed 372 times by 1 test: return "info";
Executed by:
  • tst_selftests - unknown status
372
26 }-
27 return
never executed: return "??????";
"??????";
never executed: return "??????";
0
28 }-
29-
30 static const char* xmlIncidentType2String(QAbstractTestLogger::IncidentTypes type)-
31 {-
32 switch (type) {-
33 case
executed 2247 times by 1 test: case QAbstractTestLogger::Pass:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::Pass:
executed 2247 times by 1 test: case QAbstractTestLogger::Pass:
Executed by:
  • tst_selftests - unknown status
2247
34 return
executed 2247 times by 1 test: return "pass";
Executed by:
  • tst_selftests - unknown status
"pass";
executed 2247 times by 1 test: return "pass";
Executed by:
  • tst_selftests - unknown status
2247
35 case
executed 180 times by 1 test: case QAbstractTestLogger::XFail:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::XFail:
executed 180 times by 1 test: case QAbstractTestLogger::XFail:
Executed by:
  • tst_selftests - unknown status
180
36 return
executed 180 times by 1 test: return "xfail";
Executed by:
  • tst_selftests - unknown status
"xfail";
executed 180 times by 1 test: return "xfail";
Executed by:
  • tst_selftests - unknown status
180
37 case
executed 1245 times by 1 test: case QAbstractTestLogger::Fail:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::Fail:
executed 1245 times by 1 test: case QAbstractTestLogger::Fail:
Executed by:
  • tst_selftests - unknown status
1245
38 return
executed 1245 times by 1 test: return "fail";
Executed by:
  • tst_selftests - unknown status
"fail";
executed 1245 times by 1 test: return "fail";
Executed by:
  • tst_selftests - unknown status
1245
39 case
executed 48 times by 1 test: case QAbstractTestLogger::XPass:
Executed by:
  • tst_selftests - unknown status
QAbstractTestLogger::XPass:
executed 48 times by 1 test: case QAbstractTestLogger::XPass:
Executed by:
  • tst_selftests - unknown status
48
40 return
executed 48 times by 1 test: return "xpass";
Executed by:
  • tst_selftests - unknown status
"xpass";
executed 48 times by 1 test: return "xpass";
Executed by:
  • tst_selftests - unknown status
48
41 case
never executed: case QAbstractTestLogger::BlacklistedPass:
QAbstractTestLogger::BlacklistedPass:
never executed: case QAbstractTestLogger::BlacklistedPass:
0
42 return
never executed: return "bpass";
"bpass";
never executed: return "bpass";
0
43 case
never executed: case QAbstractTestLogger::BlacklistedFail:
QAbstractTestLogger::BlacklistedFail:
never executed: case QAbstractTestLogger::BlacklistedFail:
0
44 return
never executed: return "bfail";
"bfail";
never executed: return "bfail";
0
45 }-
46 return
never executed: return "??????";
"??????";
never executed: return "??????";
0
47 }-
48-
49}-
50-
51-
52QXmlTestLogger::QXmlTestLogger(XmlMode mode, const char *filename)-
53 : QAbstractTestLogger(filename), xmlmode(mode)-
54{-
55}
executed 369 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
369
56-
57QXmlTestLogger::~QXmlTestLogger()-
58{-
59}-
60-
61void QXmlTestLogger::startLogging()-
62{-
63 QAbstractTestLogger::startLogging();-
64 QTestCharBuffer buf;-
65-
66 if (xmlmode == QXmlTestLogger::Complete
xmlmode == QXm...gger::CompleteDescription
TRUEevaluated 184 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 185 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
184-185
67 QTestCharBuffer quotedTc;-
68 xmlQuote(&quotedTc, QTestResult::currentTestObjectName());-
69 QTest::qt_asprintf(&buf,-
70 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"-
71 "<TestCase name=\"%s\">\n", quotedTc.constData());-
72 outputString(buf.constData());-
73 }
executed 184 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
184
74-
75 QTestCharBuffer quotedBuild;-
76 xmlQuote(&quotedBuild, QLibraryInfo::build());-
77-
78 QTest::qt_asprintf(&buf,-
79 "<Environment>\n"-
80 " <QtVersion>%s</QtVersion>\n"-
81 " <QtBuild>%s</QtBuild>\n"-
82 " <QTestVersion>" "5.7.1" "</QTestVersion>\n"-
83 "</Environment>\n", qVersion(), quotedBuild.constData());-
84 outputString(buf.constData());-
85}
executed 369 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
369
86-
87void QXmlTestLogger::stopLogging()-
88{-
89 QTestCharBuffer buf;-
90 QTest::qt_asprintf(&buf,-
91 "<Duration msecs=\"%f\"/>\n", QTestLog::msecsTotalTime());-
92 outputString(buf.constData());-
93 if (xmlmode == QXmlTestLogger::Complete
xmlmode == QXm...gger::CompleteDescription
TRUEevaluated 184 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 185 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
184-185
94 outputString("</TestCase>\n");-
95 }
executed 184 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
184
96-
97 QAbstractTestLogger::stopLogging();-
98}
executed 369 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
369
99-
100void QXmlTestLogger::enterTestFunction(const char *function)-
101{-
102 QTestCharBuffer buf;-
103 QTestCharBuffer quotedFunction;-
104 xmlQuote(&quotedFunction, function);-
105 QTest::qt_asprintf(&buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData());-
106 outputString(buf.constData());-
107}
executed 2274 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
2274
108-
109void QXmlTestLogger::leaveTestFunction()-
110{-
111 QTestCharBuffer buf;-
112 QTest::qt_asprintf(&buf,-
113 " <Duration msecs=\"%f\"/>\n"-
114 "</TestFunction>\n",-
115 QTestLog::msecsFunctionTime());-
116-
117 outputString(buf.constData());-
118}
executed 2274 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
2274
119-
120namespace QTest-
121{-
122-
123inline static bool isEmpty(const char *str)-
124{-
125 return
executed 59406 times by 1 test: return !str || !str[0];
Executed by:
  • tst_selftests - unknown status
!str || !str[0];
executed 59406 times by 1 test: return !str || !str[0];
Executed by:
  • tst_selftests - unknown status
59406
126}-
127-
128static const char *incidentFormatString(bool noDescription, bool noTag)-
129{-
130 if (noDescription
noDescriptionDescription
TRUEevaluated 2247 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1473 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
1473-2247
131 if (noTag
noTagDescription
TRUEevaluated 879 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1368 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
879-1368
132 return
executed 879 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\" />\n";
Executed by:
  • tst_selftests - unknown status
"<Incident type=\"%s\" file=\"%s\" line=\"%d\" />\n";
executed 879 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\" />\n";
Executed by:
  • tst_selftests - unknown status
879
133 else-
134 return
executed 1368 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
"<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n"
executed 1368 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
1368
135 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n"
executed 1368 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
1368
136 "</Incident>\n";
executed 1368 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
1368
137 } else {-
138 if (noTag
noTagDescription
TRUEevaluated 549 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 924 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
549-924
139 return
executed 549 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
"<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n"
executed 549 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
549
140 " <Description><![CDATA[%s%s%s%s]]></Description>\n"
executed 549 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
549
141 "</Incident>\n";
executed 549 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
549
142 else-
143 return
executed 924 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
"<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n"
executed 924 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
924
144 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n"
executed 924 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
924
145 " <Description><![CDATA[%s]]></Description>\n"
executed 924 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
924
146 "</Incident>\n";
executed 924 times by 1 test: return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n";
Executed by:
  • tst_selftests - unknown status
924
147 }-
148}-
149-
150static const char *benchmarkResultFormatString()-
151{-
152 return
executed 132 times by 1 test: return "<BenchmarkResult metric=\"%s\" tag=\"%s\" value=\"%s\" iterations=\"%d\" />\n";
Executed by:
  • tst_selftests - unknown status
"<BenchmarkResult metric=\"%s\" tag=\"%s\" value=\"%s\" iterations=\"%d\" />\n";
executed 132 times by 1 test: return "<BenchmarkResult metric=\"%s\" tag=\"%s\" value=\"%s\" iterations=\"%d\" />\n";
Executed by:
  • tst_selftests - unknown status
132
153}-
154-
155static const char *messageFormatString(bool noDescription, bool noTag)-
156{-
157 if (noDescription
noDescriptionDescription
TRUEnever evaluated
FALSEevaluated 26025 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
0-26025
158 if (noTag
noTagDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
159 return
never executed: return "<Message type=\"%s\" file=\"%s\" line=\"%d\" />\n";
"<Message type=\"%s\" file=\"%s\" line=\"%d\" />\n";
never executed: return "<Message type=\"%s\" file=\"%s\" line=\"%d\" />\n";
0
160 else-
161 return
never executed: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Message>\n";
"<Message type=\"%s\" file=\"%s\" line=\"%d\">\n"
never executed: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Message>\n";
0
162 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n"
never executed: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Message>\n";
0
163 "</Message>\n";
never executed: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" "</Message>\n";
0
164 } else {-
165 if (noTag
noTagDescription
TRUEevaluated 24501 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1524 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
1524-24501
166 return
executed 24501 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
"<Message type=\"%s\" file=\"%s\" line=\"%d\">\n"
executed 24501 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
24501
167 " <Description><![CDATA[%s%s%s%s]]></Description>\n"
executed 24501 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
24501
168 "</Message>\n";
executed 24501 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <Description><![CDATA[%s%s%s%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
24501
169 else-
170 return
executed 1524 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
"<Message type=\"%s\" file=\"%s\" line=\"%d\">\n"
executed 1524 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
1524
171 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n"
executed 1524 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
1524
172 " <Description><![CDATA[%s]]></Description>\n"
executed 1524 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
1524
173 "</Message>\n";
executed 1524 times by 1 test: return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Message>\n";
Executed by:
  • tst_selftests - unknown status
1524
174 }-
175}-
176-
177}-
178-
179void QXmlTestLogger::addIncident(IncidentTypes type, const char *description,-
180 const char *file, int line)-
181{-
182 QTestCharBuffer buf;-
183 const char *tag = QTestResult::currentDataTag();-
184 const char *gtag = QTestResult::currentGlobalDataTag();-
185 const char *filler = (tag
tagDescription
TRUEevaluated 2292 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
&& gtag
gtagDescription
TRUEevaluated 84 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 2208 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) ? ":" : "";
84-2292
186 const bool notag = QTest::isEmpty(tag)
QTest::isEmpty(tag)Description
TRUEevaluated 1428 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 2292 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
&& QTest::isEmpty(gtag)
QTest::isEmpty(gtag)Description
TRUEevaluated 1428 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
;
0-2292
187-
188 QTestCharBuffer quotedFile;-
189 QTestCharBuffer cdataGtag;-
190 QTestCharBuffer cdataTag;-
191 QTestCharBuffer cdataDescription;-
192-
193 xmlQuote(&quotedFile, file);-
194 xmlCdata(&cdataGtag, gtag);-
195 xmlCdata(&cdataTag, tag);-
196 xmlCdata(&cdataDescription, description);-
197-
198 QTest::qt_asprintf(&buf,-
199 QTest::incidentFormatString(QTest::isEmpty(description), notag),-
200 QTest::xmlIncidentType2String(type),-
201 quotedFile.constData(), line,-
202 cdataGtag.constData(),-
203 filler,-
204 cdataTag.constData(),-
205 cdataDescription.constData());-
206-
207 outputString(buf.constData());-
208}
executed 3720 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
3720
209-
210void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result)-
211{-
212 QTestCharBuffer buf;-
213 QTestCharBuffer quotedMetric;-
214 QTestCharBuffer quotedTag;-
215-
216 xmlQuote(&quotedMetric,-
217 benchmarkMetricName(result.metric));-
218 xmlQuote(&quotedTag, result.context.tag.toUtf8().constData());-
219-
220 const qreal valuePerIteration = qreal(result.value) / qreal(result.iterations);-
221 QTest::qt_asprintf(-
222 &buf,-
223 QTest::benchmarkResultFormatString(),-
224 quotedMetric.constData(),-
225 quotedTag.constData(),-
226 QByteArray::number(valuePerIteration).constData(),-
227 result.iterations);-
228 outputString(buf.constData());-
229}
executed 132 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
132
230-
231void QXmlTestLogger::addMessage(MessageTypes type, const QString &message,-
232 const char *file, int line)-
233{-
234 QTestCharBuffer buf;-
235 const char *tag = QTestResult::currentDataTag();-
236 const char *gtag = QTestResult::currentGlobalDataTag();-
237 const char *filler = (tag
tagDescription
TRUEevaluated 1512 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 24513 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
&& gtag
gtagDescription
TRUEevaluated 408 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1104 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) ? ":" : "";
408-24513
238 const bool notag = QTest::isEmpty(tag)
QTest::isEmpty(tag)Description
TRUEevaluated 24513 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1512 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
&& QTest::isEmpty(gtag)
QTest::isEmpty(gtag)Description
TRUEevaluated 24501 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
;
12-24513
239-
240 QTestCharBuffer quotedFile;-
241 QTestCharBuffer cdataGtag;-
242 QTestCharBuffer cdataTag;-
243 QTestCharBuffer cdataDescription;-
244-
245 xmlQuote(&quotedFile, file);-
246 xmlCdata(&cdataGtag, gtag);-
247 xmlCdata(&cdataTag, tag);-
248 xmlCdata(&cdataDescription, message.toUtf8().constData());-
249-
250 QTest::qt_asprintf(&buf,-
251 QTest::messageFormatString(message.isEmpty(), notag),-
252 QTest::xmlMessageType2String(type),-
253 quotedFile.constData(), line,-
254 cdataGtag.constData(),-
255 filler,-
256 cdataTag.constData(),-
257 cdataDescription.constData());-
258-
259 outputString(buf.constData());-
260}
executed 26025 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
26025
261-
262-
263-
264-
265-
266-
267int QXmlTestLogger::xmlQuote(QTestCharBuffer* destBuf, char const* src, size_t n)-
268{-
269 if (n == 0
n == 0Description
TRUEnever evaluated
FALSEevaluated 71069 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) return
never executed: return 0;
0;
never executed: return 0;
0-71069
270-
271 char *dest = destBuf->data();-
272 *dest = 0;-
273 if (!src
!srcDescription
TRUEevaluated 27597 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 43472 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) return
executed 27597 times by 1 test: return 0;
Executed by:
  • tst_selftests - unknown status
0;
executed 27597 times by 1 test: return 0;
Executed by:
  • tst_selftests - unknown status
27597-43472
274-
275 char* begin = dest;-
276 char* end = dest + n;-
277-
278 while (dest < end
dest < endDescription
TRUEevaluated 471029 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
28-471029
279 switch (*src) {-
280 case
executed 253 times by 1 test: case '>':
Executed by:
  • tst_selftests - unknown status
'>':
executed 253 times by 1 test: case '>':
Executed by:
  • tst_selftests - unknown status
if (dest + sizeof("&gt;") < end
dest + sizeof("&gt;") < endDescription
TRUEevaluated 253 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
) { strcpy(dest, "&gt;"); dest += sizeof("&gt;") - 1; }
executed 253 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else { *dest = 0; return
never executed: return (dest+sizeof("&gt;")-begin);
(dest+sizeof("&gt;")-begin);
never executed: return (dest+sizeof("&gt;")-begin);
} ++src; break;
executed 253 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
;
0-253
281 case
executed 187 times by 1 test: case '<':
Executed by:
  • tst_selftests - unknown status
'<':
executed 187 times by 1 test: case '<':
Executed by:
  • tst_selftests - unknown status
if (dest + sizeof("&lt;") < end
dest + sizeof("&lt;") < endDescription
TRUEevaluated 187 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
) { strcpy(dest, "&lt;"); dest += sizeof("&lt;") - 1; }
executed 187 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else { *dest = 0; return
never executed: return (dest+sizeof("&lt;")-begin);
(dest+sizeof("&lt;")-begin);
never executed: return (dest+sizeof("&lt;")-begin);
} ++src; break;
executed 187 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
;
0-187
282 case
executed 588 times by 1 test: case '\'':
Executed by:
  • tst_selftests - unknown status
'\'':
executed 588 times by 1 test: case '\'':
Executed by:
  • tst_selftests - unknown status
if (dest + sizeof("&apos;") < end
dest + sizeof("&apos;") < endDescription
TRUEevaluated 588 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
) { strcpy(dest, "&apos;"); dest += sizeof("&apos;") - 1; }
executed 588 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else { *dest = 0; return
never executed: return (dest+sizeof("&apos;")-begin);
(dest+sizeof("&apos;")-begin);
never executed: return (dest+sizeof("&apos;")-begin);
} ++src; break;
executed 588 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
;
0-588
283 case
executed 666 times by 1 test: case '"':
Executed by:
  • tst_selftests - unknown status
'"':
executed 666 times by 1 test: case '"':
Executed by:
  • tst_selftests - unknown status
if (dest + sizeof("&quot;") < end
dest + sizeof("&quot;") < endDescription
TRUEevaluated 666 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
) { strcpy(dest, "&quot;"); dest += sizeof("&quot;") - 1; }
executed 666 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else { *dest = 0; return
never executed: return (dest+sizeof("&quot;")-begin);
(dest+sizeof("&quot;")-begin);
never executed: return (dest+sizeof("&quot;")-begin);
} ++src; break;
executed 666 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
;
0-666
284 case
never executed: case '&':
'&':
never executed: case '&':
if (dest + sizeof("&amp;") < end
dest + sizeof("&amp;") < endDescription
TRUEnever evaluated
FALSEnever evaluated
) { strcpy(dest, "&amp;"); dest += sizeof("&amp;") - 1; }
never executed: end of block
else { *dest = 0; return
never executed: return (dest+sizeof("&amp;")-begin);
(dest+sizeof("&amp;")-begin);
never executed: return (dest+sizeof("&amp;")-begin);
} ++src; break;
never executed: break;
;
0
285-
286-
287-
288 case
executed 1217 times by 1 test: case '-':
Executed by:
  • tst_selftests - unknown status
'-':
executed 1217 times by 1 test: case '-':
Executed by:
  • tst_selftests - unknown status
if (dest + sizeof("&#x002D;") < end
dest + sizeof(...x002D;") < endDescription
TRUEevaluated 1217 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
) { strcpy(dest, "&#x002D;"); dest += sizeof("&#x002D;") - 1; }
executed 1217 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else { *dest = 0; return
never executed: return (dest+sizeof("&#x002D;")-begin);
(dest+sizeof("&#x002D;")-begin);
never executed: return (dest+sizeof("&#x002D;")-begin);
} ++src; break;
executed 1217 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
;
0-1217
289-
290-
291-
292 case
executed 43444 times by 1 test: case 0:
Executed by:
  • tst_selftests - unknown status
0:
executed 43444 times by 1 test: case 0:
Executed by:
  • tst_selftests - unknown status
43444
293 *dest = 0;-
294 return
executed 43444 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
(dest-begin);
executed 43444 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
43444
295-
296 default
executed 424674 times by 1 test: default:
Executed by:
  • tst_selftests - unknown status
:
executed 424674 times by 1 test: default:
Executed by:
  • tst_selftests - unknown status
424674
297 *dest = *src;-
298 ++dest;-
299 ++src;-
300 break;
executed 424674 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
424674
301 }-
302 }-
303-
304-
305 *(dest-1) = 0;-
306 return
executed 28 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
(dest-begin);
executed 28 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
28
307}-
308-
309-
310-
311-
312-
313int QXmlTestLogger::xmlCdata(QTestCharBuffer *destBuf, char const* src, size_t n)-
314{-
315 if (!n
!nDescription
TRUEnever evaluated
FALSEevaluated 104566 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) return
never executed: return 0;
0;
never executed: return 0;
0-104566
316-
317 char *dest = destBuf->data();-
318-
319 if (!src
!srcDescription
TRUEevaluated 55182 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 49384 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
|| n == 1
n == 1Description
TRUEnever evaluated
FALSEevaluated 49384 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
0-55182
320 *dest = 0;-
321 return
executed 55182 times by 1 test: return 0;
Executed by:
  • tst_selftests - unknown status
0;
executed 55182 times by 1 test: return 0;
Executed by:
  • tst_selftests - unknown status
55182
322 }-
323-
324 static char const CDATA_END[] = "]]>";-
325 static char const CDATA_END_ESCAPED[] = "]]]><![CDATA[]>";-
326-
327 char* begin = dest;-
328 char* end = dest + n;-
329 while (dest < end
dest < endDescription
TRUEevaluated 457940 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
48-457940
330 if (!*src
!*srcDescription
TRUEevaluated 49336 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 408604 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
49336-408604
331 *dest = 0;-
332 return
executed 49336 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
(dest-begin);
executed 49336 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
49336
333 }-
334-
335 if (!strncmp(src, CDATA_END, sizeof(CDATA_END)-1)
!strncmp(src, ...(CDATA_END)-1)Description
TRUEevaluated 250 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 408354 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
250-408354
336 if (dest + sizeof(CDATA_END_ESCAPED) < end
dest + sizeof(...ESCAPED) < endDescription
TRUEevaluated 250 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
) {
0-250
337 strcpy(dest, CDATA_END_ESCAPED);-
338 src += sizeof(CDATA_END)-1;-
339 dest += sizeof(CDATA_END_ESCAPED) - 1;-
340 }
executed 250 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
250
341 else {-
342 *dest = 0;-
343 return
never executed: return (dest+sizeof(CDATA_END_ESCAPED)-begin);
(dest+sizeof(CDATA_END_ESCAPED)-begin);
never executed: return (dest+sizeof(CDATA_END_ESCAPED)-begin);
0
344 }-
345 continue;
executed 250 times by 1 test: continue;
Executed by:
  • tst_selftests - unknown status
250
346 }-
347-
348 *dest = *src;-
349 ++src;-
350 ++dest;-
351 }
executed 408354 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
408354
352-
353-
354 *(dest-1) = 0;-
355 return
executed 48 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
(dest-begin);
executed 48 times by 1 test: return (dest-begin);
Executed by:
  • tst_selftests - unknown status
48
356}-
357-
358typedef int (*StringFormatFunction)(QTestCharBuffer*,char const*,size_t);-
359-
360-
361-
362-
363-
364int allocateStringFn(QTestCharBuffer* str, char const* src, StringFormatFunction func)-
365{-
366 static const int MAXSIZE = 1024*1024*2;-
367-
368 int size = str->size();-
369-
370 int res = 0;-
371-
372 for (;;) {-
373 res = func(str, src, size);-
374 str->data()[size - 1] = '\0';-
375 if (res < size
res < sizeDescription
TRUEevaluated 175559 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
76-175559
376-
377 break;
executed 175559 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
175559
378 }-
379-
380 size *= 2;-
381 if (size > MAXSIZE
size > MAXSIZEDescription
TRUEnever evaluated
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
0-76
382 break;
never executed: break;
0
383 }-
384 if (!str->reset(size)
!str->reset(size)Description
TRUEnever evaluated
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
0-76
385 break;
never executed: break;
0
386 }
executed 76 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
76
387-
388 return
executed 175559 times by 1 test: return res;
Executed by:
  • tst_selftests - unknown status
res;
executed 175559 times by 1 test: return res;
Executed by:
  • tst_selftests - unknown status
175559
389}-
390-
391int QXmlTestLogger::xmlQuote(QTestCharBuffer* str, char const* src)-
392{-
393 return
executed 71041 times by 1 test: return allocateStringFn(str, src, QXmlTestLogger::xmlQuote);
Executed by:
  • tst_selftests - unknown status
allocateStringFn(str, src, QXmlTestLogger::xmlQuote);
executed 71041 times by 1 test: return allocateStringFn(str, src, QXmlTestLogger::xmlQuote);
Executed by:
  • tst_selftests - unknown status
71041
394}-
395-
396int QXmlTestLogger::xmlCdata(QTestCharBuffer* str, char const* src)-
397{-
398 return
executed 104518 times by 1 test: return allocateStringFn(str, src, QXmlTestLogger::xmlCdata);
Executed by:
  • tst_selftests - unknown status
allocateStringFn(str, src, QXmlTestLogger::xmlCdata);
executed 104518 times by 1 test: return allocateStringFn(str, src, QXmlTestLogger::xmlCdata);
Executed by:
  • tst_selftests - unknown status
104518
399}-
400-
401-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9