28 #include "Verbosity.h" 30 #include "TestRunner.h" 31 #include "MetaAssertion.h" 37 const char MetaAssertion::kMessageDone[] PROGMEM =
"done";
38 const char MetaAssertion::kMessageNotDone[] PROGMEM =
"not done";
39 const char MetaAssertion::kMessagePassed[] PROGMEM =
"passed";
40 const char MetaAssertion::kMessageNotPassed[] PROGMEM =
"not passed";
41 const char MetaAssertion::kMessageFailed[] PROGMEM =
"failed";
42 const char MetaAssertion::kMessageNotFailed[] PROGMEM =
"not failed";
43 const char MetaAssertion::kMessageSkipped[] PROGMEM =
"skipped";
44 const char MetaAssertion::kMessageNotSkipped[] PROGMEM =
"not skipped";
45 const char MetaAssertion::kMessageExpired[] PROGMEM =
"timed out";
46 const char MetaAssertion::kMessageNotExpired[] PROGMEM =
"not timed out";
52 void printAssertionTestStatusMessage(
53 bool ok,
const char* file, uint16_t line,
54 const char* testName,
const __FlashStringHelper* statusMessage) {
58 printer->print(
"Assertion ");
59 printer->print(ok ?
"passed" :
"failed");
60 printer->print(F(
": Test "));
61 printer->print(testName);
62 printer->print(
" is ");
63 printer->print(statusMessage);
64 printer->print(
", file ");
66 printer->print(
", line ");
68 printer->println(
'.');
74 const char* testName,
const __FlashStringHelper* statusMessage,
bool ok) {
75 if (
isDone())
return false;
77 printAssertionTestStatusMessage(ok, file, line, testName, statusMessage);
87 void printStatusNowMessage(
const char* file, uint16_t line,
88 const __FlashStringHelper* statusString) {
92 printer->print(F(
"Status "));
93 printer->print(statusString);
94 printer->print(
", file ");
96 printer->print(
", line ");
98 printer->println(
'.');
111 uint8_t status,
const __FlashStringHelper* statusString) {
114 printStatusNowMessage(file, line, statusString);
static const uint8_t kTestExpired
Print test timed out message.
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
static const uint8_t kTestPassed
Print test passed message.
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
bool isOutputEnabled(bool ok)
Returns true if an assertion message should be printed.
bool isVerbosity(uint8_t verbosity)
Determine if any of the given verbosity is enabled.
bool isDone()
Return true if test has been asserted.
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
static const uint8_t kTestSkipped
Print test skipped message.
Various macros to smooth over the differences among the various platforms with regards to their suppo...
static const uint8_t kTestFailed
Print test failed message.
void setStatus(uint8_t status)
Set the status of the test.