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 > | |
T | Take (std::deque< T > *c) |
Protected Attributes | |
std::deque< DiagnosticDetail > | error_records_ |
std::deque< DiagnosticDetail > | warning_records_ |
DiagnosticPolicy | diagnostic_policy_ |
void ClearDiagnostics | ( | ) |
|
protected |
|
protected |
void FlushDiagnostics | ( | ) |
|
protected |
|
protected |
int NumErrors | ( | ) |
Return the current number of errors.
int NumWarnings | ( | ) |
Return the current number of warnings.
|
protected |
|
protected |
std::string TakeError | ( | ) |
Remove an error from internal records and return its formatted string.
std::string TakeWarning | ( | ) |
Remove a warning from internal records and return its formatted string.
|
protected |
|
protected |
|
protected |
|
protected |