GUITEST: Add test for checking XML report version.
This commit is contained in:
parent
5175e4ff3f
commit
11378108fa
|
@ -35,3 +35,14 @@ void TestXmlReport::testUnquoteMessage()
|
|||
QCOMPARE(toQuote, XmlReport::unquoteMessage(quoted));
|
||||
}
|
||||
|
||||
void TestXmlReport::testGetVersion1()
|
||||
{
|
||||
const QString filepath("xmlfiles/xmlreport_v1.xml");
|
||||
QCOMPARE(1, XmlReport::determineVersion(filepath));
|
||||
}
|
||||
|
||||
void TestXmlReport::testGetVersion2()
|
||||
{
|
||||
const QString filepath("xmlfiles/xmlreport_v2.xml");
|
||||
QCOMPARE(2, XmlReport::determineVersion(filepath));
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ class TestXmlReport: public QObject
|
|||
private slots:
|
||||
void testQuoteMessage();
|
||||
void testUnquoteMessage();
|
||||
void testGetVersion1();
|
||||
void testGetVersion2();
|
||||
};
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<results>
|
||||
<error file="test.cxx" line="11" id="unreadVariable" severity="Style" msg="Variable &#039;a&#039; is assigned a value that is never used"/>
|
||||
<error file="test.cxx" line="28" id="unreadVariable" severity="Style" msg="Variable &#039;b&#039; is assigned a value that is never used"/>
|
||||
<error file="test.cxx" line="31" id="memleak" severity="Error" msg="Memory leak: b"/>
|
||||
<error file="test.cxx" line="16" id="mismatchAllocDealloc" severity="Error" msg="Mismatching allocation and deallocation: k"/>
|
||||
<error file="test.cxx" line="31" id="obsoleteFunctionsgets" severity="Style" msg="Found obsolete function &#039;gets&#039;. With gets you&#039;ll get buffer overruns if the input data too big for the buffer. It is recommended to use the function &#039;fgets&#039; instead."/>
|
||||
<error file="test.cxx" line="22" id="postfixOperator" severity="performance" msg="Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code."/>
|
||||
</results>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<results version="2">
|
||||
<cppcheck version="1.47"/>
|
||||
<errors>
|
||||
<error id="unreadVariable" severity="style" msg="Variable &#039;a&#039; is assigned a value that is never used" verbose="Variable &#039;a&#039; is assigned a value that is never used">
|
||||
<location file="test.cxx" line="11"/>
|
||||
</error>
|
||||
<error id="unreadVariable" severity="style" msg="Variable &#039;b&#039; is assigned a value that is never used" verbose="Variable &#039;b&#039; is assigned a value that is never used">
|
||||
<location file="test.cxx" line="28"/>
|
||||
</error>
|
||||
<error id="memleak" severity="error" msg="Memory leak: b" verbose="Memory leak: b">
|
||||
<location file="test.cxx" line="31"/>
|
||||
</error>
|
||||
<error id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k" verbose="Mismatching allocation and deallocation: k">
|
||||
<location file="test.cxx" line="32"/>
|
||||
<location file="test.cxx" line="16"/>
|
||||
</error>
|
||||
<error id="obsoleteFunctionsgets" severity="style" msg="Found obsolete function &#039;gets&#039;. It is recommended to use the function &#039;fgets&#039; instead" verbose="Found obsolete function &#039;gets&#039;. With gets you&#039;ll get buffer overruns if the input data too big for the buffer. It is recommended to use the function &#039;fgets&#039; instead.">
|
||||
<location file="test.cxx" line="31"/>
|
||||
</error>
|
||||
<error id="postfixOperator" severity="performance" msg="Prefer prefix ++/-- operators for non-primitive types." verbose="Prefix ++/-- operators should be preferred for non-primitive types. Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.">
|
||||
<location file="test.cxx" line="22"/>
|
||||
</error>
|
||||
</errors>
|
||||
</results>
|
Loading…
Reference in New Issue