KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KI_TEST::CAPTURING_REPORTER Class Reference

Custom REPORTER that captures all messages for later analysis in the unit test framework. More...

#include <board_test_utils.h>

Inheritance diagram for KI_TEST::CAPTURING_REPORTER:
REPORTER

Classes

struct  MESSAGE
 

Public Types

enum  LOCATION { LOC_HEAD = 0 , LOC_BODY , LOC_TAIL }
 Location where the message is to be reported. More...
 

Public Member Functions

 CAPTURING_REPORTER ()
 
REPORTERReport (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
 Report a string with a given severity.
 
bool HasMessage () const override
 Returns true if any messages were reported.
 
EDA_UNITS GetUnits () const override
 
void Clear () override
 
void PrintAllMessages (const std::string &aContext) const
 
int GetErrorCount () const
 
int GetWarningCount () const
 
const std::vector< MESSAGE > & GetMessages () const
 
REPORTERReport (const char *aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 
virtual REPORTERReportTail (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 Places the report at the end of the list, for objects that support report ordering.
 
virtual REPORTERReportHead (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 Places the report at the beginning of the list for objects that support ordering.
 
REPORTERoperator<< (const wxString &aText)
 
virtual bool HasMessageOfSeverity (int aSeverityMask) const
 Returns true if the reporter has one or more messages matching the specified severity mask.
 

Private Attributes

std::vector< MESSAGEm_messages
 
int m_errorCount
 
int m_warningCount
 
int m_infoCount
 
int m_reportedSeverityMask
 

Detailed Description

Custom REPORTER that captures all messages for later analysis in the unit test framework.

Definition at line 262 of file board_test_utils.h.

Member Enumeration Documentation

◆ LOCATION

enum REPORTER::LOCATION
inherited

Location where the message is to be reported.

LOC_HEAD messages are printed before all others (typically intro messages) LOC_BODY messages are printed in the middle LOC_TAIL messages are printed after all others (typically status messages)

Enumerator
LOC_HEAD 
LOC_BODY 
LOC_TAIL 

Definition at line 88 of file reporter.h.

Constructor & Destructor Documentation

◆ CAPTURING_REPORTER()

KI_TEST::CAPTURING_REPORTER::CAPTURING_REPORTER ( )
inline

Definition at line 271 of file board_test_utils.h.

References m_errorCount, m_infoCount, and m_warningCount.

Member Function Documentation

◆ Clear()

void KI_TEST::CAPTURING_REPORTER::Clear ( )
inlineoverridevirtual

Reimplemented from REPORTER.

Definition at line 284 of file board_test_utils.h.

References m_errorCount, m_infoCount, m_messages, and m_warningCount.

◆ GetErrorCount()

int KI_TEST::CAPTURING_REPORTER::GetErrorCount ( ) const
inline

Definition at line 294 of file board_test_utils.h.

References m_errorCount.

Referenced by BOOST_AUTO_TEST_CASE(), and RunBoardLoad().

◆ GetMessages()

const std::vector< MESSAGE > & KI_TEST::CAPTURING_REPORTER::GetMessages ( ) const
inline

Definition at line 296 of file board_test_utils.h.

References m_messages.

Referenced by RunBoardLoad().

◆ GetUnits()

EDA_UNITS KI_TEST::CAPTURING_REPORTER::GetUnits ( ) const
inlineoverridevirtual

Reimplemented from REPORTER.

Definition at line 282 of file board_test_utils.h.

References MM.

◆ GetWarningCount()

int KI_TEST::CAPTURING_REPORTER::GetWarningCount ( ) const
inline

Definition at line 295 of file board_test_utils.h.

References m_warningCount.

Referenced by RunBoardLoad().

◆ HasMessage()

bool KI_TEST::CAPTURING_REPORTER::HasMessage ( ) const
inlineoverridevirtual

Returns true if any messages were reported.

Reimplemented from REPORTER.

Definition at line 280 of file board_test_utils.h.

References m_messages.

◆ HasMessageOfSeverity()

◆ operator<<()

REPORTER & REPORTER::operator<< ( const wxString & aText)
inlineinherited

Definition at line 129 of file reporter.h.

References Report(), and REPORTER().

◆ PrintAllMessages()

void KI_TEST::CAPTURING_REPORTER::PrintAllMessages ( const std::string & aContext) const

◆ Report() [1/2]

REPORTER & KI_TEST::CAPTURING_REPORTER::Report ( const wxString & aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED )
overridevirtual

Report a string with a given severity.

Parameters
aTextis the string to report.
aSeverityis an indicator ( RPT_UNDEFINED, RPT_INFO, RPT_WARNING, RPT_ERROR, RPT_ACTION ) used to filter and format messages

Reimplemented from REPORTER.

Definition at line 794 of file board_test_utils.cpp.

References m_errorCount, m_infoCount, m_messages, m_warningCount, REPORTER::REPORTER(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, RPT_SEVERITY_WARNING, KI_TEST::CAPTURING_REPORTER::MESSAGE::severity, and KI_TEST::CAPTURING_REPORTER::MESSAGE::text.

◆ Report() [2/2]

REPORTER & REPORTER::Report ( const char * aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED )
inherited

Definition at line 50 of file reporter.cpp.

References From_UTF8(), Report(), and REPORTER().

◆ ReportHead()

virtual REPORTER & REPORTER::ReportHead ( const wxString & aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED )
inlinevirtualinherited

Places the report at the beginning of the list for objects that support ordering.

Reimplemented in WX_HTML_PANEL_REPORTER.

Definition at line 121 of file reporter.h.

References Report(), REPORTER(), and RPT_SEVERITY_UNDEFINED.

Referenced by BACK_ANNOTATE::applyChangelist(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DIALOG_IMPORT_NETLIST::loadNetlist(), DIALOG_EXPORT_NETLIST::TransferDataFromWindow(), and SCH_EDIT_FRAME::WriteNetListFile().

◆ ReportTail()

Member Data Documentation

◆ m_errorCount

int KI_TEST::CAPTURING_REPORTER::m_errorCount
private

◆ m_infoCount

int KI_TEST::CAPTURING_REPORTER::m_infoCount
private

Definition at line 302 of file board_test_utils.h.

Referenced by CAPTURING_REPORTER(), Clear(), and Report().

◆ m_messages

std::vector<MESSAGE> KI_TEST::CAPTURING_REPORTER::m_messages
private

Definition at line 299 of file board_test_utils.h.

Referenced by Clear(), GetMessages(), HasMessage(), PrintAllMessages(), and Report().

◆ m_reportedSeverityMask

int REPORTER::m_reportedSeverityMask
privateinherited

Definition at line 159 of file reporter.h.

Referenced by Clear(), HasMessage(), HasMessageOfSeverity(), Report(), and REPORTER().

◆ m_warningCount

int KI_TEST::CAPTURING_REPORTER::m_warningCount
private

The documentation for this class was generated from the following files: