MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / readXml

Method readXml

gui/test/xmlreportv2/testxmlreportv2.cpp:27–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include <QtTest>
26
27void TestXmlReportV2::readXml() const
28{
29 const QString filepath(QString(SRCDIR) + "/../data/xmlfiles/xmlreport_v2.xml");
30 XmlReportV2 report(filepath, QString());
31 QVERIFY(report.open());
32 QList<ErrorItem> errors = report.read();
33 QCOMPARE(errors.size(), 6);
34
35 const ErrorItem &item = errors[0];
36 QCOMPARE(item.errorPath.size(), 1);
37 QCOMPARE(item.errorPath[0].file, QString("test.cxx"));
38 QCOMPARE(item.errorPath[0].line, 11);
39 QCOMPARE(item.errorId, QString("unreadVariable"));
40 QCOMPARE(GuiSeverity::toString(item.severity), QString("style"));
41 QCOMPARE(item.summary, QString("Variable 'a' is assigned a value that is never used"));
42 QCOMPARE(item.message, QString("Variable 'a' is assigned a value that is never used"));
43
44 const ErrorItem &item2 = errors[3];
45 QCOMPARE(item2.errorPath.size(), 2);
46 QCOMPARE(item2.errorPath[0].file, QString("test.cxx"));
47 QCOMPARE(item2.errorPath[0].line, 16);
48 QCOMPARE(item2.errorPath[1].file, QString("test.cxx"));
49 QCOMPARE(item2.errorPath[1].line, 32);
50 QCOMPARE(item2.errorId, QString("mismatchAllocDealloc"));
51 QCOMPARE(GuiSeverity::toString(item2.severity), QString("error"));
52 QCOMPARE(item2.summary, QString("Mismatching allocation and deallocation: k"));
53 QCOMPARE(item2.message, QString("Mismatching allocation and deallocation: k"));
54}
55
56QTEST_MAIN(TestXmlReportV2)

Callers

nothing calls this directly

Calls 5

QStringClass · 0.50
toStringFunction · 0.50
openMethod · 0.45
readMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected