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

Method SerializeSanitize

test/testerrorlogger.cpp:638–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636 }
637
638 void SerializeSanitize() const {
639 ErrorMessage msg({}, "", Severity::error, std::string("Illegal character in \"foo\001bar\""), "errorId", Certainty::normal);
640 msg.file0 = "1.c";
641
642 const std::string msg_str = msg.serialize();
643 ASSERT_EQUALS("7 errorId"
644 "5 error"
645 "1 0"
646 "1 0"
647 "0 "
648 "3 1.c"
649 "1 0"
650 "33 Illegal character in \"foo\\001bar\""
651 "33 Illegal character in \"foo\\001bar\""
652 "0 "
653 "0 ", msg_str);
654
655 ErrorMessage msg2;
656 ASSERT_NO_THROW(msg2.deserialize(msg_str));
657 ASSERT_EQUALS("errorId", msg2.id);
658 ASSERT_EQUALS_ENUM(Severity::error, msg2.severity);
659 ASSERT_EQUALS("1.c", msg2.file0);
660 ASSERT_EQUALS("Illegal character in \"foo\\001bar\"", msg2.shortMessage());
661 ASSERT_EQUALS("Illegal character in \"foo\\001bar\"", msg2.verboseMessage());
662 }
663
664 void SerializeFileLocation() const {
665 ErrorMessage::FileLocation loc1(":/,;", "abcd:/,", 654, 33);

Callers

nothing calls this directly

Calls 2

deserializeMethod · 0.80
serializeMethod · 0.45

Tested by

no test coverage detected