@@ -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,67 @@ 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 std::string format = " {severity} {id}" ;
336+
337+ {
338+ const auto reportType = ReportType::misraCpp2023;
339+ const auto mapping = createGuidelineMapping (reportType);
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+ const auto reportType = ReportType::misraCpp2023;
350+ const auto mapping = createGuidelineMapping (reportType);
351+ ErrorMessage msg (locs, emptyString, Severity::warning, " " , " misra-cpp-2023-6.8.4" , Certainty::normal);
352+ msg.guideline = getGuideline (msg.id , reportType, mapping, msg.severity );
353+ msg.classification = getClassification (msg.guideline , reportType);
354+ ASSERT_EQUALS (" Advisory" , msg.classification );
355+ ASSERT_EQUALS (" 6.8.4" , msg.guideline );
356+ ASSERT_EQUALS (" Advisory 6.8.4" , msg.toString (true , format, " " ));
357+ }
358+
359+ {
360+ const auto reportType = ReportType::misraCpp2023;
361+ const auto mapping = createGuidelineMapping (reportType);
362+ ErrorMessage msg (locs, emptyString, Severity::style, " " , " premium-misra-cpp-2023-19.6.1" , Certainty::normal);
363+ msg.guideline = getGuideline (msg.id , reportType, mapping, msg.severity );
364+ msg.classification = getClassification (msg.guideline , reportType);
365+ ASSERT_EQUALS (" Advisory" , msg.classification );
366+ ASSERT_EQUALS (" 19.6.1" , msg.guideline );
367+ ASSERT_EQUALS (" Advisory 19.6.1" , msg.toString (true , format, " " ));
368+ }
369+
370+ {
371+ const auto reportType = ReportType::misraCpp2008;
372+ const auto mapping = createGuidelineMapping (reportType);
373+ ErrorMessage msg (locs, emptyString, Severity::style, " " , " premium-misra-cpp-2008-3-4-1" , Certainty::normal);
374+ msg.guideline = getGuideline (msg.id , reportType, mapping, msg.severity );
375+ msg.classification = getClassification (msg.guideline , reportType);
376+ ASSERT_EQUALS (" Required" , msg.classification );
377+ ASSERT_EQUALS (" 3-4-1" , msg.guideline );
378+ ASSERT_EQUALS (" Required 3-4-1" , msg.toString (true , format, " " ));
379+ }
380+
381+ {
382+ const auto reportType = ReportType::misraCpp2008;
383+ const auto mapping = createGuidelineMapping (reportType);
384+ ErrorMessage msg (locs, emptyString, Severity::style, " " , " misra-cpp-2008-3-4-1" , Certainty::normal);
385+ msg.guideline = getGuideline (msg.id , reportType, mapping, msg.severity );
386+ msg.classification = getClassification (msg.guideline , reportType);
387+ ASSERT_EQUALS (" Required" , msg.classification );
388+ ASSERT_EQUALS (" 3-4-1" , msg.guideline );
389+ ASSERT_EQUALS (" Required 3-4-1" , msg.toString (true , format, " " ));
390+ }
391+
392+ }
393+
332394 void ErrorMessageReportTypeMisraCDirective () const {
333395 std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
334396 const auto reportType = ReportType::misraC2012;
0 commit comments