Skip to content

Commit c707321

Browse files
committed
add test
1 parent 129055d commit c707321

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

test/testerrorlogger.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class TestErrorLogger : public TestFixture {
7878
TEST_CASE(isCriticalErrorId);
7979

8080
TEST_CASE(ErrorMessageReportTypeMisraC);
81+
TEST_CASE(ErrorMessageReportTypeMisraCpp);
8182
TEST_CASE(ErrorMessageReportTypeMisraCDirective);
8283
TEST_CASE(ErrorMessageReportTypeCertC);
8384
}
@@ -329,6 +330,32 @@ class TestErrorLogger : public TestFixture {
329330
ASSERT_EQUALS("Advisory 2.8", msg.toString(true, format, ""));
330331
}
331332

333+
void ErrorMessageReportTypeMisraCpp() const {
334+
std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
335+
const auto reportType = ReportType::misraCpp2023;
336+
const auto mapping = createGuidelineMapping(reportType);
337+
const std::string format = "{severity} {id}";
338+
339+
{
340+
ErrorMessage msg(locs, emptyString, Severity::warning, "", "premium-misra-cpp-2023-6.8.4", Certainty::normal);
341+
msg.guideline = getGuideline(msg.id, reportType, mapping, msg.severity);
342+
msg.classification = getClassification(msg.guideline, reportType);
343+
ASSERT_EQUALS("Advisory", msg.classification);
344+
ASSERT_EQUALS("6.8.4", msg.guideline);
345+
ASSERT_EQUALS("Advisory 6.8.4", msg.toString(true, format, ""));
346+
}
347+
348+
{
349+
ErrorMessage msg(locs, emptyString, Severity::style, "", "premium-misra-cpp-2023-19.6.1", Certainty::normal);
350+
msg.guideline = getGuideline(msg.id, reportType, mapping, msg.severity);
351+
msg.classification = getClassification(msg.guideline, reportType);
352+
ASSERT_EQUALS("Advisory", msg.classification);
353+
ASSERT_EQUALS("19.6.1", msg.guideline);
354+
ASSERT_EQUALS("Advisory 19.6.1", msg.toString(true, format, ""));
355+
}
356+
357+
}
358+
332359
void ErrorMessageReportTypeMisraCDirective() const {
333360
std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
334361
const auto reportType = ReportType::misraC2012;

0 commit comments

Comments
 (0)