Drake
Drake C++ Documentation
DiagnosticPolicyTestBase Class Reference

Detailed Description

A base class for test fixtures that involve DiagnosticPolicy output.

It sets error and warning actions on construction to collect all diagnostics. On destruction, it expects its internal warning and error collections to be empty. Test cases meet this requirement by calling TakeError() and/or TakeWarning() to consume and examine expected diagnostics.

#include <drake/common/test_utilities/diagnostic_policy_test_base.h>

Classes

class  ScopedTrace
 

Public Member Functions

 DiagnosticPolicyTestBase ()
 
 ~DiagnosticPolicyTestBase ()
 
std::string TakeError ()
 Remove an error from internal records and return its formatted string. More...
 
std::string TakeWarning ()
 Remove a warning from internal records and return its formatted string. More...
 
int NumErrors ()
 Return the current number of errors. More...
 
int NumWarnings ()
 Return the current number of warnings. More...
 
void ClearDiagnostics ()
 
void FlushDiagnostics ()
 

Protected Member Functions

std::string DumpErrors ()
 
std::string DumpWarnings ()
 
void ThrowErrors ()
 
void RecordErrors ()
 
std::string FormatFirstError ()
 
std::string FormatFirstWarning ()
 
template<typename T >
Take (std::deque< T > *c)
 

Protected Attributes

std::deque< DiagnosticDetail > error_records_
 
std::deque< DiagnosticDetail > warning_records_
 
DiagnosticPolicy diagnostic_policy_
 

Constructor & Destructor Documentation

◆ DiagnosticPolicyTestBase()

◆ ~DiagnosticPolicyTestBase()

Member Function Documentation

◆ ClearDiagnostics()

void ClearDiagnostics ( )

◆ DumpErrors()

std::string DumpErrors ( )
protected

◆ DumpWarnings()

std::string DumpWarnings ( )
protected

◆ FlushDiagnostics()

void FlushDiagnostics ( )

◆ FormatFirstError()

std::string FormatFirstError ( )
protected

◆ FormatFirstWarning()

std::string FormatFirstWarning ( )
protected

◆ NumErrors()

int NumErrors ( )

Return the current number of errors.

◆ NumWarnings()

int NumWarnings ( )

Return the current number of warnings.

◆ RecordErrors()

void RecordErrors ( )
protected

◆ Take()

T Take ( std::deque< T > *  c)
protected

◆ TakeError()

std::string TakeError ( )

Remove an error from internal records and return its formatted string.

◆ TakeWarning()

std::string TakeWarning ( )

Remove a warning from internal records and return its formatted string.

◆ ThrowErrors()

void ThrowErrors ( )
protected

Member Data Documentation

◆ diagnostic_policy_

DiagnosticPolicy diagnostic_policy_
protected

◆ error_records_

std::deque<DiagnosticDetail> error_records_
protected

◆ warning_records_

std::deque<DiagnosticDetail> warning_records_
protected

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