qtestxunitstreamer.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/testlib/qtestxunitstreamer.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4QTestXunitStreamer::QTestXunitStreamer(QXunitTestLogger *logger)-
5 : testLogger(logger)-
6{-
7 do { if (!(testLogger)
!(testLogger)Description
TRUEnever evaluated
FALSEevaluated 215 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) qt_assert("testLogger",__FILE__,48);
never executed: qt_assert("testLogger",__FILE__,48);
} while (0);
0-215
8}
executed 215 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
215
9-
10QTestXunitStreamer::~QTestXunitStreamer()-
11{}-
12-
13void QTestXunitStreamer::indentForElement(const QTestElement* element, char* buf, int size)-
14{-
15 if (size == 0
size == 0Description
TRUEnever evaluated
FALSEevaluated 35334 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) return;
never executed: return;
0-35334
16-
17 buf[0] = 0;-
18-
19 if (!element
!elementDescription
TRUEnever evaluated
FALSEevaluated 35334 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) return;
never executed: return;
0-35334
20-
21 char* endbuf = buf + size;-
22 element = element->parentElement();-
23 while (element
elementDescription
TRUEevaluated 66840 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 35334 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
&& buf+2 < endbuf
buf+2 < endbufDescription
TRUEevaluated 66840 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
) {
0-66840
24 *(buf++) = ' ';-
25 *(buf++) = ' ';-
26 *buf = 0;-
27 element = element->parentElement();-
28 }
executed 66840 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
66840
29}
executed 35334 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
35334
30-
31void QTestXunitStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const-
32{-
33 if (!element
!elementDescription
TRUEnever evaluated
FALSEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
|| !formatted
!formattedDescription
TRUEnever evaluated
FALSEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
0-33885
34 return;
never executed: return;
0
35-
36 char indent[20];-
37 indentForElement(element, indent, sizeof(indent));-
38-
39-
40 if (element->elementType() == QTest::LET_Error
element->eleme...est::LET_ErrorDescription
TRUEevaluated 30566 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 3319 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
3319-30566
41 if (element->parentElement()->elementType() == QTest::LET_SystemError
element->paren...ET_SystemErrorDescription
TRUEevaluated 15283 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 15283 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
15283
42 QTest::qt_asprintf(formatted, "<![CDATA[");-
43 }
executed 15283 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else {
15283
44 QTest::qt_asprintf(formatted, "%s<!--", indent);-
45 }
executed 15283 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
15283
46 return;
executed 30566 times by 1 test: return;
Executed by:
  • tst_selftests - unknown status
30566
47 }-
48-
49 QTest::qt_asprintf(formatted, "%s<%s", indent, element->elementName());-
50}
executed 3319 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
3319
51-
52void QTestXunitStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const-
53{-
54 if (!element
!elementDescription
TRUEnever evaluated
FALSEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
|| !formatted
!formattedDescription
TRUEnever evaluated
FALSEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
0-33885
55 return;
never executed: return;
0
56-
57 if (!element->childElements()
!element->childElements()Description
TRUEevaluated 32436 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1449 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
1449-32436
58 formatted->data()[0] = '\0';-
59 return;
executed 32436 times by 1 test: return;
Executed by:
  • tst_selftests - unknown status
32436
60 }-
61-
62 char indent[20];-
63 indentForElement(element, indent, sizeof(indent));-
64-
65 QTest::qt_asprintf(formatted, "%s</%s>\n", indent, element->elementName());-
66}
executed 1449 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
1449
67-
68void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const-
69{-
70 if (!attribute
!attributeDescription
TRUEnever evaluated
FALSEevaluated 87818 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
|| !formatted
!formattedDescription
TRUEnever evaluated
FALSEevaluated 87818 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
0-87818
71 return;
never executed: return;
0
72-
73 QTest::AttributeIndex attrindex = attribute->index();-
74-
75-
76 if (element
elementDescription
TRUEevaluated 87818 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
&& element->elementType() == QTest::LET_Error
element->eleme...est::LET_ErrorDescription
TRUEevaluated 77343 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 10475 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
0-87818
77 && element->parentElement()->elementType() == QTest::LET_SystemError
element->paren...ET_SystemErrorDescription
TRUEevaluated 15283 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 62060 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
15283-62060
78-
79 if (attrindex != QTest::AI_Description
attrindex != Q...AI_DescriptionDescription
TRUEnever evaluated
FALSEevaluated 15283 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) return;
never executed: return;
0-15283
80-
81 QXmlTestLogger::xmlCdata(formatted, attribute->value());-
82 return;
executed 15283 times by 1 test: return;
Executed by:
  • tst_selftests - unknown status
15283
83 }-
84-
85 char const* key = 0;-
86 if (attrindex == QTest::AI_Description
attrindex == Q...AI_DescriptionDescription
TRUEevaluated 16008 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 56527 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
16008-56527
87 key = "message";
executed 16008 times by 1 test: key = "message";
Executed by:
  • tst_selftests - unknown status
16008
88 else if (attrindex != QTest::AI_File
attrindex != QTest::AI_FileDescription
TRUEevaluated 39306 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 17221 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
&& attrindex != QTest::AI_Line
attrindex != QTest::AI_LineDescription
TRUEevaluated 22085 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 17221 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
17221-39306
89 key = attribute->name();
executed 22085 times by 1 test: key = attribute->name();
Executed by:
  • tst_selftests - unknown status
22085
90-
91 if (key
keyDescription
TRUEevaluated 38093 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 34442 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
34442-38093
92 QTestCharBuffer quotedValue;-
93 QXmlTestLogger::xmlQuote(&quotedValue, attribute->value());-
94 QTest::qt_asprintf(formatted, " %s=\"%s\"", key, quotedValue.constData());-
95 }
executed 38093 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else {
38093
96 formatted->data()[0] = '\0';-
97 }
executed 34442 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
34442
98}-
99-
100void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const-
101{-
102 if (!element
!elementDescription
TRUEnever evaluated
FALSEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
|| !formatted
!formattedDescription
TRUEnever evaluated
FALSEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
0-33885
103 return;
never executed: return;
0
104-
105-
106 if (element->elementType() == QTest::LET_Error
element->eleme...est::LET_ErrorDescription
TRUEevaluated 30566 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 3319 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
3319-30566
107 if (element->parentElement()->elementType() == QTest::LET_SystemError
element->paren...ET_SystemErrorDescription
TRUEevaluated 15283 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 15283 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
15283
108 QTest::qt_asprintf(formatted, "]]>\n");-
109 }
executed 15283 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
else {
15283
110 QTest::qt_asprintf(formatted, " -->\n");-
111 }
executed 15283 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
15283
112 return;
executed 30566 times by 1 test: return;
Executed by:
  • tst_selftests - unknown status
30566
113 }-
114-
115 if (!element->childElements()
!element->childElements()Description
TRUEevaluated 1870 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1449 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
1449-1870
116 QTest::qt_asprintf(formatted, "/>\n");
executed 1870 times by 1 test: QTest::qt_asprintf(formatted, "/>\n");
Executed by:
  • tst_selftests - unknown status
1870
117 else-
118 QTest::qt_asprintf(formatted, ">\n");
executed 1449 times by 1 test: QTest::qt_asprintf(formatted, ">\n");
Executed by:
  • tst_selftests - unknown status
1449
119}-
120-
121void QTestXunitStreamer::output(QTestElement *element) const-
122{-
123 do { if (!(element)
!(element)Description
TRUEnever evaluated
FALSEevaluated 215 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) qt_assert("element",__FILE__,164);
never executed: qt_assert("element",__FILE__,164);
} while (0);
0-215
124-
125 outputString("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");-
126 outputElements(element);-
127}
executed 215 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
215
128-
129void QTestXunitStreamer::outputElements(QTestElement *element, bool) const-
130{-
131 QTestCharBuffer buf;-
132 bool hasChildren;-
133-
134-
135-
136-
137 while (element
elementDescription
TRUEevaluated 33961 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
&& element->nextElement()
element->nextElement()Description
TRUEevaluated 32297 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1664 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
0-33961
138 element = element->nextElement();-
139 }
executed 32297 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
32297
140 while (element
elementDescription
TRUEevaluated 33961 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 1664 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
1664-33961
141 hasChildren = element->childElements();-
142-
143 if (element->elementType() != QTest::LET_Benchmark
element->eleme...:LET_BenchmarkDescription
TRUEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
76-33885
144 formatStart(element, &buf);-
145 outputString(buf.data());-
146-
147 outputElementAttributes(element, element->attributes());-
148-
149 formatAfterAttributes(element, &buf);-
150 outputString(buf.data());-
151-
152 if (hasChildren
hasChildrenDescription
TRUEevaluated 1449 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 32436 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
)
1449-32436
153 outputElements(element->childElements(), true);
executed 1449 times by 1 test: outputElements(element->childElements(), true);
Executed by:
  • tst_selftests - unknown status
1449
154-
155 formatEnd(element, &buf);-
156 outputString(buf.data());-
157 }
executed 33885 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
33885
158 element = element->previousElement();-
159 }
executed 33961 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
33961
160}
executed 1664 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
1664
161-
162void QTestXunitStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const-
163{-
164 QTestCharBuffer buf;-
165 while (attribute
attributeDescription
TRUEevaluated 87818 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 33885 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
) {
33885-87818
166 formatAttributes(element, attribute, &buf);-
167 outputString(buf.data());-
168 attribute = attribute->nextElement();-
169 }
executed 87818 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
87818
170}
executed 33885 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
33885
171-
172void QTestXunitStreamer::outputString(const char *msg) const-
173{-
174 testLogger->outputString(msg);-
175}
executed 189688 times by 1 test: end of block
Executed by:
  • tst_selftests - unknown status
189688
176-
177-
Switch to Source codePreprocessed file

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