qtesttable.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7class QTestTablePrivate -
8{ -
9public: -
10 struct ElementList -
11 { -
12 ElementList(): elementName(0), elementType(0), next(0) {}
executed: }
Execution Count:5550
5550
13 const char *elementName; -
14 int elementType; -
15 ElementList *next; -
16 }; -
17 -
18 struct DataList -
19 { -
20 DataList(): data(0), next(0) {}
executed: }
Execution Count:61136
61136
21 QTestData *data; -
22 DataList *next; -
23 }; -
24 -
25 QTestTablePrivate(): list(0), dataList(0) {}
executed: }
Execution Count:7218
7218
26 ~QTestTablePrivate(); -
27 -
28 ElementList *list; -
29 DataList *dataList; -
30 -
31 void addColumn(int elemType, const char *elemName); -
32 void addRow(QTestData *data); -
33 ElementList *elementAt(int index); -
34 QTestData *dataAt(int index); -
35 -
36 static QTestTable *currentTestTable; -
37 static QTestTable *gTable; -
38}; -
39 -
40QTestTable *QTestTablePrivate::currentTestTable = 0; -
41QTestTable *QTestTablePrivate::gTable = 0; -
42 -
43QTestTablePrivate::ElementList *QTestTablePrivate::elementAt(int index) -
44{ -
45 ElementList *iter = list; -
46 for (int i = 0; i < index; ++i) {
evaluated: i < index
TRUEFALSE
yes
Evaluation Count:1081780
yes
Evaluation Count:547122
547122-1081780
47 if (!iter)
partially evaluated: !iter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1081780
0-1081780
48 return 0;
never executed: return 0;
0
49 iter = iter->next; -
50 }
executed: }
Execution Count:1081780
1081780
51 return iter;
executed: return iter;
Execution Count:547122
547122
52} -
53 -
54QTestData *QTestTablePrivate::dataAt(int index) -
55{ -
56 DataList *iter = dataList; -
57 for (int i = 0; i < index; ++i) {
evaluated: i < index
TRUEFALSE
yes
Evaluation Count:184058187
yes
Evaluation Count:61587
61587-184058187
58 if (!iter)
partially evaluated: !iter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:184058187
0-184058187
59 return 0;
never executed: return 0;
0
60 iter = iter->next; -
61 }
executed: }
Execution Count:184058187
184058187
62 return iter ? iter->data : 0;
executed: return iter ? iter->data : 0;
Execution Count:61587
61587
63} -
64 -
65QTestTablePrivate::~QTestTablePrivate() -
66{ -
67 DataList *dit = dataList; -
68 while (dit) {
evaluated: dit
TRUEFALSE
yes
Evaluation Count:61133
yes
Evaluation Count:7204
7204-61133
69 DataList *next = dit->next; -
70 delete dit->data; -
71 delete dit; -
72 dit = next; -
73 }
executed: }
Execution Count:61133
61133
74 ElementList *iter = list; -
75 while (iter) {
evaluated: iter
TRUEFALSE
yes
Evaluation Count:5549
yes
Evaluation Count:7204
5549-7204
76 ElementList *next = iter->next; -
77 delete iter; -
78 iter = next; -
79 }
executed: }
Execution Count:5549
5549
80}
executed: }
Execution Count:7204
7204
81 -
82void QTestTablePrivate::addColumn(int elemType, const char *elemName) -
83{ -
84 ElementList *item = new ElementList; -
85 item->elementName = elemName; -
86 item->elementType = elemType; -
87 if (!list) {
evaluated: !list
TRUEFALSE
yes
Evaluation Count:1867
yes
Evaluation Count:3683
1867-3683
88 list = item; -
89 return;
executed: return;
Execution Count:1867
1867
90 } -
91 ElementList *last = list; -
92 while (last->next != 0)
evaluated: last->next != 0
TRUEFALSE
yes
Evaluation Count:7290
yes
Evaluation Count:3683
3683-7290
93 last = last->next;
executed: last = last->next;
Execution Count:7290
7290
94 last->next = item; -
95}
executed: }
Execution Count:3683
3683
96 -
97void QTestTablePrivate::addRow(QTestData *data) -
98{ -
99 DataList *item = new DataList; -
100 item->data = data; -
101 if (!dataList) {
evaluated: !dataList
TRUEFALSE
yes
Evaluation Count:1796
yes
Evaluation Count:59340
1796-59340
102 dataList = item; -
103 return;
executed: return;
Execution Count:1796
1796
104 } -
105 DataList *last = dataList; -
106 while (last->next != 0)
evaluated: last->next != 0
TRUEFALSE
yes
Evaluation Count:183989585
yes
Evaluation Count:59340
59340-183989585
107 last = last->next;
executed: last = last->next;
Execution Count:183989585
183989585
108 last->next = item; -
109}
executed: }
Execution Count:59340
59340
110 -
111void QTestTable::addColumn(int type, const char *name) -
112{ -
113 do { if (!(type)) qt_assert("type","qtesttable.cpp",158); } while (0);
never executed: qt_assert("type","qtesttable.cpp",158);
executed: }
Execution Count:5550
partially evaluated: !(type)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5550
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5550
0-5550
114 do { if (!(name)) qt_assert("name","qtesttable.cpp",159); } while (0);
never executed: qt_assert("name","qtesttable.cpp",159);
executed: }
Execution Count:5550
partially evaluated: !(name)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5550
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5550
0-5550
115 -
116 d->addColumn(type, name); -
117}
executed: }
Execution Count:5550
5550
118 -
119int QTestTable::elementCount() const -
120{ -
121 QTestTablePrivate::ElementList *item = d->list; -
122 int count = 0; -
123 while (item) {
evaluated: item
TRUEFALSE
yes
Evaluation Count:2350215
yes
Evaluation Count:547031
547031-2350215
124 ++count; -
125 item = item->next; -
126 }
executed: }
Execution Count:2350215
2350215
127 return count;
executed: return count;
Execution Count:547031
547031
128} -
129 -
130 -
131int QTestTable::dataCount() const -
132{ -
133 QTestTablePrivate::DataList *item = d->dataList; -
134 int count = 0; -
135 while (item) {
evaluated: item
TRUEFALSE
yes
Evaluation Count:61589
yes
Evaluation Count:13623
13623-61589
136 ++count; -
137 item = item->next; -
138 }
executed: }
Execution Count:61589
61589
139 return count;
executed: return count;
Execution Count:13623
13623
140} -
141 -
142bool QTestTable::isEmpty() const -
143{ -
144 return !d->list;
executed: return !d->list;
Execution Count:6879
6879
145} -
146 -
147QTestData *QTestTable::newData(const char *tag) -
148{ -
149 QTestData *dt = new QTestData(tag, this); -
150 d->addRow(dt); -
151 return dt;
executed: return dt;
Execution Count:61136
61136
152} -
153 -
154QTestTable::QTestTable() -
155{ -
156 d = new QTestTablePrivate; -
157 QTestTablePrivate::currentTestTable = this; -
158}
executed: }
Execution Count:7218
7218
159 -
160QTestTable::~QTestTable() -
161{ -
162 QTestTablePrivate::currentTestTable = 0; -
163 delete d; -
164}
executed: }
Execution Count:7204
7204
165 -
166int QTestTable::elementTypeId(int index) const -
167{ -
168 QTestTablePrivate::ElementList *item = d->elementAt(index); -
169 if (!item)
partially evaluated: !item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:547122
0-547122
170 return -1;
never executed: return -1;
0
171 return item->elementType;
executed: return item->elementType;
Execution Count:547122
547122
172} -
173 -
174const char *QTestTable::dataTag(int index) const -
175{ -
176 QTestTablePrivate::ElementList *item = d->elementAt(index); -
177 if (!item)
never evaluated: !item
0
178 return 0;
never executed: return 0;
0
179 return item->elementName;
never executed: return item->elementName;
0
180} -
181 -
182QTestData *QTestTable::testData(int index) const -
183{ -
184 return d->dataAt(index);
executed: return d->dataAt(index);
Execution Count:61587
61587
185} -
186 -
187int QTestTable::indexOf(const char *elementName) const -
188{ -
189 do { if (!(elementName)) qt_assert("elementName","qtesttable.cpp",234); } while (0);
never executed: qt_assert("elementName","qtesttable.cpp",234);
executed: }
Execution Count:182312
partially evaluated: !(elementName)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:182312
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:182312
0-182312
190 -
191 QTestTablePrivate::ElementList *item = d->list; -
192 int i = 0; -
193 while (item) {
partially evaluated: item
TRUEFALSE
yes
Evaluation Count:528734
no
Evaluation Count:0
0-528734
194 if (strcmp(elementName, item->elementName) == 0)
evaluated: strcmp(elementName, item->elementName) == 0
TRUEFALSE
yes
Evaluation Count:182312
yes
Evaluation Count:346422
182312-346422
195 return i;
executed: return i;
Execution Count:182312
182312
196 item = item->next; -
197 ++i; -
198 }
executed: }
Execution Count:346422
346422
199 return -1;
never executed: return -1;
0
200} -
201 -
202QTestTable *QTestTable::globalTestTable() -
203{ -
204 if (!QTestTablePrivate::gTable)
evaluated: !QTestTablePrivate::gTable
TRUEFALSE
yes
Evaluation Count:399
yes
Evaluation Count:6819
399-6819
205 QTestTablePrivate::gTable = new QTestTable();
executed: QTestTablePrivate::gTable = new QTestTable();
Execution Count:399
399
206 return QTestTablePrivate::gTable;
executed: return QTestTablePrivate::gTable;
Execution Count:7218
7218
207} -
208 -
209void QTestTable::clearGlobalTestTable() -
210{ -
211 delete QTestTablePrivate::gTable; -
212 QTestTablePrivate::gTable = 0; -
213}
executed: }
Execution Count:391
391
214 -
215QTestTable *QTestTable::currentTestTable() -
216{ -
217 return QTestTablePrivate::currentTestTable;
executed: return QTestTablePrivate::currentTestTable;
Execution Count:66686
66686
218} -
219 -
220 -
221 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial