GUITEST: Add test for checking XML report version.

This commit is contained in:
Kimmo Varis 2011-02-09 16:57:29 +02:00
parent 5175e4ff3f
commit 11378108fa
4 changed files with 47 additions and 0 deletions

View File

@ -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));
}

View File

@ -26,4 +26,6 @@ class TestXmlReport: public QObject
private slots:
void testQuoteMessage();
void testUnquoteMessage();
void testGetVersion1();
void testGetVersion2();
};

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<results>
<error file="test.cxx" line="11" id="unreadVariable" severity="Style" msg="Variable &amp;#039;a&amp;#039; is assigned a value that is never used"/>
<error file="test.cxx" line="28" id="unreadVariable" severity="Style" msg="Variable &amp;#039;b&amp;#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 &amp;#039;gets&amp;#039;. With gets you&amp;#039;ll get buffer overruns if the input data too big for the buffer. It is recommended to use the function &amp;#039;fgets&amp;#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>

View File

@ -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 &amp;#039;a&amp;#039; is assigned a value that is never used" verbose="Variable &amp;#039;a&amp;#039; is assigned a value that is never used">
<location file="test.cxx" line="11"/>
</error>
<error id="unreadVariable" severity="style" msg="Variable &amp;#039;b&amp;#039; is assigned a value that is never used" verbose="Variable &amp;#039;b&amp;#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 &amp;#039;gets&amp;#039;. It is recommended to use the function &amp;#039;fgets&amp;#039; instead" verbose="Found obsolete function &amp;#039;gets&amp;#039;. With gets you&amp;#039;ll get buffer overruns if the input data too big for the buffer. It is recommended to use the function &amp;#039;fgets&amp;#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>