2010-12-05 21:23:36 +01:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2011-01-09 20:33:36 +01:00
|
|
|
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
2010-12-05 21:23:36 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <list>
|
2011-02-03 08:44:23 +01:00
|
|
|
#include "cppcheck.h"
|
2010-12-05 21:23:36 +01:00
|
|
|
#include "testsuite.h"
|
|
|
|
#include "errorlogger.h"
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
class TestErrorLogger : public TestFixture {
|
2010-12-05 21:23:36 +01:00
|
|
|
public:
|
|
|
|
TestErrorLogger() : TestFixture("TestErrorLogger")
|
|
|
|
{ }
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void run() {
|
2010-12-05 21:23:36 +01:00
|
|
|
TEST_CASE(FileLocationDefaults);
|
|
|
|
TEST_CASE(FileLocationSetFile);
|
|
|
|
TEST_CASE(ErrorMessageConstruct);
|
2011-07-16 12:41:31 +02:00
|
|
|
TEST_CASE(ErrorMessageConstructLocations);
|
2010-12-05 21:23:36 +01:00
|
|
|
TEST_CASE(ErrorMessageVerbose);
|
2011-07-16 12:41:31 +02:00
|
|
|
TEST_CASE(ErrorMessageVerboseLocations);
|
2010-12-05 21:23:36 +01:00
|
|
|
TEST_CASE(CustomFormat);
|
|
|
|
TEST_CASE(CustomFormat2);
|
2011-07-16 12:41:31 +02:00
|
|
|
TEST_CASE(CustomFormatLocations);
|
2010-12-05 21:23:36 +01:00
|
|
|
TEST_CASE(ToXml);
|
2011-07-16 12:41:31 +02:00
|
|
|
TEST_CASE(ToXmlLocations);
|
2010-12-05 21:23:36 +01:00
|
|
|
TEST_CASE(ToVerboseXml);
|
2011-07-16 12:41:31 +02:00
|
|
|
TEST_CASE(ToVerboseXmlLocations);
|
2011-02-03 08:44:23 +01:00
|
|
|
TEST_CASE(ToXmlV2);
|
2011-07-16 12:41:31 +02:00
|
|
|
TEST_CASE(ToXmlV2Locations);
|
2011-04-10 21:51:27 +02:00
|
|
|
|
|
|
|
// Inconclusive results in xml reports..
|
|
|
|
TEST_CASE(InconclusiveXml);
|
2011-04-16 13:42:48 +02:00
|
|
|
|
|
|
|
// Serialize / Deserialize inconclusive message
|
|
|
|
TEST_CASE(SerializeInconclusiveMessage);
|
2010-12-05 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void FileLocationDefaults() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
ASSERT_EQUALS("", loc.getfile());
|
|
|
|
ASSERT_EQUALS(0, loc.line);
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void FileLocationSetFile() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
ASSERT_EQUALS("foo.cpp", loc.getfile());
|
|
|
|
ASSERT_EQUALS(0, loc.line);
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ErrorMessageConstruct() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
2011-04-14 18:02:01 +02:00
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.", "errorId", false);
|
2011-01-01 09:16:31 +01:00
|
|
|
ASSERT_EQUALS(1, (int)msg._callStack.size());
|
2010-12-05 21:23:36 +01:00
|
|
|
ASSERT_EQUALS("Programming error.", msg.shortMessage());
|
|
|
|
ASSERT_EQUALS("Programming error.", msg.verboseMessage());
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5]: (error) Programming error.", msg.toString(false));
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5]: (error) Programming error.", msg.toString(true));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ErrorMessageConstructLocations() {
|
2011-07-16 12:41:31 +02:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc2;
|
|
|
|
loc2.setfile("bar.cpp");
|
|
|
|
loc2.line = 8;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
|
|
|
locs.push_back(loc2);
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.", "errorId", false);
|
|
|
|
ASSERT_EQUALS(2, (int)msg._callStack.size());
|
|
|
|
ASSERT_EQUALS("Programming error.", msg.shortMessage());
|
|
|
|
ASSERT_EQUALS("Programming error.", msg.verboseMessage());
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5] -> [bar.cpp:8]: (error) Programming error.", msg.toString(false));
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5] -> [bar.cpp:8]: (error) Programming error.", msg.toString(true));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ErrorMessageVerbose() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
2011-04-14 18:02:01 +02:00
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
2011-01-01 09:16:31 +01:00
|
|
|
ASSERT_EQUALS(1, (int)msg._callStack.size());
|
2010-12-05 21:23:36 +01:00
|
|
|
ASSERT_EQUALS("Programming error.", msg.shortMessage());
|
|
|
|
ASSERT_EQUALS("Verbose error", msg.verboseMessage());
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5]: (error) Programming error.", msg.toString(false));
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5]: (error) Verbose error", msg.toString(true));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ErrorMessageVerboseLocations() {
|
2011-07-16 12:41:31 +02:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc2;
|
|
|
|
loc2.setfile("bar.cpp");
|
|
|
|
loc2.line = 8;
|
|
|
|
locs.push_back(loc);
|
|
|
|
locs.push_back(loc2);
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
|
|
|
ASSERT_EQUALS(2, (int)msg._callStack.size());
|
|
|
|
ASSERT_EQUALS("Programming error.", msg.shortMessage());
|
|
|
|
ASSERT_EQUALS("Verbose error", msg.verboseMessage());
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5] -> [bar.cpp:8]: (error) Programming error.", msg.toString(false));
|
|
|
|
ASSERT_EQUALS("[foo.cpp:5] -> [bar.cpp:8]: (error) Verbose error", msg.toString(true));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void CustomFormat() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
2011-04-14 18:02:01 +02:00
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
2011-01-01 09:16:31 +01:00
|
|
|
ASSERT_EQUALS(1, (int)msg._callStack.size());
|
2010-12-05 21:23:36 +01:00
|
|
|
ASSERT_EQUALS("Programming error.", msg.shortMessage());
|
|
|
|
ASSERT_EQUALS("Verbose error", msg.verboseMessage());
|
|
|
|
ASSERT_EQUALS("foo.cpp:5,error,errorId,Programming error.", msg.toString(false, "{file}:{line},{severity},{id},{message}"));
|
|
|
|
ASSERT_EQUALS("foo.cpp:5,error,errorId,Verbose error", msg.toString(true, "{file}:{line},{severity},{id},{message}"));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void CustomFormat2() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
2011-04-14 18:02:01 +02:00
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
2011-01-01 09:16:31 +01:00
|
|
|
ASSERT_EQUALS(1, (int)msg._callStack.size());
|
2010-12-05 21:23:36 +01:00
|
|
|
ASSERT_EQUALS("Programming error.", msg.shortMessage());
|
|
|
|
ASSERT_EQUALS("Verbose error", msg.verboseMessage());
|
|
|
|
ASSERT_EQUALS("Programming error. - foo.cpp(5):(error,errorId)", msg.toString(false, "{message} - {file}({line}):({severity},{id})"));
|
|
|
|
ASSERT_EQUALS("Verbose error - foo.cpp(5):(error,errorId)", msg.toString(true, "{message} - {file}({line}):({severity},{id})"));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void CustomFormatLocations() {
|
2011-07-16 12:41:31 +02:00
|
|
|
// Check that first location from location stack is used in template
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc2;
|
|
|
|
loc2.setfile("bar.cpp");
|
|
|
|
loc2.line = 8;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
|
|
|
locs.push_back(loc2);
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
|
|
|
ASSERT_EQUALS(2, (int)msg._callStack.size());
|
|
|
|
ASSERT_EQUALS("Programming error.", msg.shortMessage());
|
|
|
|
ASSERT_EQUALS("Verbose error", msg.verboseMessage());
|
|
|
|
ASSERT_EQUALS("Programming error. - bar.cpp(8):(error,errorId)", msg.toString(false, "{message} - {file}({line}):({severity},{id})"));
|
|
|
|
ASSERT_EQUALS("Verbose error - bar.cpp(8):(error,errorId)", msg.toString(true, "{message} - {file}({line}):({severity},{id})"));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ToXml() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
2011-04-14 18:02:01 +02:00
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
2011-02-04 20:14:19 +01:00
|
|
|
ASSERT_EQUALS("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
2011-02-02 18:46:07 +01:00
|
|
|
ASSERT_EQUALS("</results>", ErrorLogger::ErrorMessage::getXMLFooter(1));
|
2010-12-05 21:23:36 +01:00
|
|
|
ASSERT_EQUALS("<error file=\"foo.cpp\" line=\"5\" id=\"errorId\" severity=\"error\" msg=\"Programming error.\"/>", msg.toXML(false,1));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ToXmlLocations() {
|
2011-07-16 12:41:31 +02:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc2;
|
|
|
|
loc2.setfile("bar.cpp");
|
|
|
|
loc2.line = 8;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
|
|
|
locs.push_back(loc2);
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
|
|
|
ASSERT_EQUALS("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
|
|
|
ASSERT_EQUALS("</results>", ErrorLogger::ErrorMessage::getXMLFooter(1));
|
|
|
|
ASSERT_EQUALS("<error file=\"bar.cpp\" line=\"8\" id=\"errorId\" severity=\"error\" msg=\"Programming error.\"/>", msg.toXML(false,1));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ToVerboseXml() {
|
2010-12-05 21:23:36 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
2011-04-14 18:02:01 +02:00
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
2011-02-04 20:14:19 +01:00
|
|
|
ASSERT_EQUALS("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
2011-02-02 18:46:07 +01:00
|
|
|
ASSERT_EQUALS("</results>", ErrorLogger::ErrorMessage::getXMLFooter(1));
|
2010-12-05 21:23:36 +01:00
|
|
|
ASSERT_EQUALS("<error file=\"foo.cpp\" line=\"5\" id=\"errorId\" severity=\"error\" msg=\"Verbose error\"/>", msg.toXML(true,1));
|
|
|
|
}
|
2011-02-03 08:44:23 +01:00
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ToVerboseXmlLocations() {
|
2011-07-16 12:41:31 +02:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc2;
|
|
|
|
loc2.setfile("bar.cpp");
|
|
|
|
loc2.line = 8;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
|
|
|
locs.push_back(loc2);
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
|
|
|
ASSERT_EQUALS("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
|
|
|
ASSERT_EQUALS("</results>", ErrorLogger::ErrorMessage::getXMLFooter(1));
|
|
|
|
ASSERT_EQUALS("<error file=\"bar.cpp\" line=\"8\" id=\"errorId\" severity=\"error\" msg=\"Verbose error\"/>", msg.toXML(true,1));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ToXmlV2() {
|
2011-02-03 08:44:23 +01:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
2011-04-14 18:02:01 +02:00
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
2011-02-04 20:14:19 +01:00
|
|
|
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results version=\"2\">\n");
|
2011-02-03 08:44:23 +01:00
|
|
|
header += " <cppcheck version=\"";
|
|
|
|
header += CppCheck::version();
|
|
|
|
header += "\"/>\n <errors>";
|
|
|
|
ASSERT_EQUALS(header, ErrorLogger::ErrorMessage::getXMLHeader(2));
|
|
|
|
ASSERT_EQUALS(" </errors>\n</results>", ErrorLogger::ErrorMessage::getXMLFooter(2));
|
|
|
|
std::string message(" <error id=\"errorId\" severity=\"error\"");
|
|
|
|
message += " msg=\"Programming error.\" verbose=\"Verbose error\">\n";
|
|
|
|
message += " <location file=\"foo.cpp\" line=\"5\"/>\n </error>";
|
2011-07-16 12:41:31 +02:00
|
|
|
ASSERT_EQUALS(message, msg.toXML(false, 2));
|
|
|
|
}
|
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void ToXmlV2Locations() {
|
2011-07-16 12:41:31 +02:00
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc2;
|
|
|
|
loc2.setfile("bar.cpp");
|
|
|
|
loc2.line = 8;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
|
|
|
locs.push_back(loc2);
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
|
|
|
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results version=\"2\">\n");
|
|
|
|
header += " <cppcheck version=\"";
|
|
|
|
header += CppCheck::version();
|
|
|
|
header += "\"/>\n <errors>";
|
|
|
|
ASSERT_EQUALS(header, ErrorLogger::ErrorMessage::getXMLHeader(2));
|
|
|
|
ASSERT_EQUALS(" </errors>\n</results>", ErrorLogger::ErrorMessage::getXMLFooter(2));
|
|
|
|
std::string message(" <error id=\"errorId\" severity=\"error\"");
|
|
|
|
message += " msg=\"Programming error.\" verbose=\"Verbose error\">\n";
|
|
|
|
message += " <location file=\"bar.cpp\" line=\"8\"/>\n";
|
|
|
|
message += " <location file=\"foo.cpp\" line=\"5\"/>\n </error>";
|
|
|
|
ASSERT_EQUALS(message, msg.toXML(false, 2));
|
2011-02-03 08:44:23 +01:00
|
|
|
}
|
2011-04-14 03:12:35 +02:00
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void InconclusiveXml() {
|
2011-04-10 21:51:27 +02:00
|
|
|
// Location
|
|
|
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
|
|
|
loc.setfile("foo.cpp");
|
|
|
|
loc.line = 5;
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
locs.push_back(loc);
|
|
|
|
|
2011-04-14 18:02:01 +02:00
|
|
|
// Inconclusive error message
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error", "errorId", true);
|
2011-04-10 21:51:27 +02:00
|
|
|
|
|
|
|
// Don't save inconclusive messages if the xml version is 1
|
|
|
|
ASSERT_EQUALS("", msg.toXML(false, 1));
|
|
|
|
|
|
|
|
// TODO: how should inconclusive messages be saved when the xml version is 2?
|
|
|
|
ASSERT_EQUALS("", msg.toXML(false, 2));
|
|
|
|
}
|
2011-04-16 13:42:48 +02:00
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
void SerializeInconclusiveMessage() {
|
2011-04-16 13:42:48 +02:00
|
|
|
// Inconclusive error message
|
|
|
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
|
|
|
ErrorMessage msg(locs, Severity::error, "Programming error", "errorId", true);
|
|
|
|
ASSERT_EQUALS("7 errorId"
|
|
|
|
"5 error"
|
|
|
|
"12 inconclusive"
|
|
|
|
"17 Programming error"
|
|
|
|
"17 Programming error"
|
|
|
|
"0 ", msg.serialize());
|
|
|
|
|
|
|
|
ErrorMessage msg2;
|
|
|
|
msg2.deserialize(msg.serialize());
|
|
|
|
ASSERT_EQUALS("errorId", msg2._id);
|
|
|
|
ASSERT_EQUALS(Severity::error, msg2._severity);
|
|
|
|
ASSERT_EQUALS(true, msg2._inconclusive);
|
|
|
|
ASSERT_EQUALS("Programming error", msg2.shortMessage());
|
|
|
|
ASSERT_EQUALS("Programming error", msg2.verboseMessage());
|
|
|
|
}
|
2010-12-05 21:23:36 +01:00
|
|
|
};
|
|
|
|
REGISTER_TEST(TestErrorLogger)
|