39 bool _printOnPass = (getenv(
"PRINT_ON_PASS") != NULL);
41 unsigned _failures = 0;
43 bool _casePrinted =
false;
44 const char *_case = NULL;
51 checkVal(
const char *file,
const unsigned line,
52 const char *test,
const bool result)
54 if (!result || _printOnPass) {
55 if (!_casePrinted && _case) {
59 cprintf(
" CHECK %s: %s:%d %s\n",
60 result ?
"PASSED" :
"FAILED", file, line, test);
62 if (result) _passes++;
67 void printOnPass(
bool newPrintOnPass) { _printOnPass = newPrintOnPass; }
69 unsigned passes() {
return _passes; }
75 cprintf(
"TEST %s: %d checks passed, %d checks failed.\n",
76 _failures ?
"FAILED" :
"PASSED", _passes, _failures);
void checkVal(const char *file, const unsigned line, const char *test, const bool result)
Function that actually handles checking whether an EXPECT_* passed.
unsigned failures()
Function that returns the current number of failed checks.
void reset()
Zero the number of passes and failures so far.
bool printOnPass()
Print on pass is a switch that specifies whether to print a message even when a check passes...
void setCase(const char *newCase)
Sets the current test case.
unsigned passes()
Function that returns the current number of passed checks.
unsigned printResults()
Function to call at the end of a test that prints an overall result and a summary of how many checks ...
void cprintf(const char *format, const Args &...args)