gem5
v20.1.0.0
|
Functions | |
void | checkVal (const char *file, const unsigned line, const char *test, const bool result) |
Function that actually handles checking whether an EXPECT_* passed. More... | |
bool | printOnPass () |
Print on pass is a switch that specifies whether to print a message even when a check passes. More... | |
void | printOnPass (bool newVal) |
Function for setting print on pass. More... | |
unsigned | passes () |
Function that returns the current number of passed checks. More... | |
unsigned | failures () |
Function that returns the current number of failed checks. More... | |
unsigned | printResults () |
Function to call at the end of a test that prints an overall result and a summary of how many checks passed and failed. More... | |
void | reset () |
Zero the number of passes and failures so far. More... | |
void | setCase (const char *newCase) |
Sets the current test case. More... | |
void UnitTest::checkVal | ( | const char * | file, |
const unsigned | line, | ||
const char * | test, | ||
const bool | result | ||
) |
Function that actually handles checking whether an EXPECT_* passed.
This should be used through the EXPECT macros below and not called directly.
file | The name of the file this check is in. |
line | The line number this check is on. |
test | Text specifying what check is being performed. |
result | Whether the check passed. |
Definition at line 49 of file unittest.cc.
References cprintf().
unsigned UnitTest::failures | ( | ) |
Function that returns the current number of failed checks.
Definition at line 68 of file unittest.cc.
unsigned UnitTest::passes | ( | ) |
Function that returns the current number of passed checks.
Definition at line 67 of file unittest.cc.
bool UnitTest::printOnPass | ( | ) |
Print on pass is a switch that specifies whether to print a message even when a check passes.
It's default value is whether or not "PRINT_ON_PASS" is set in the calling environment. What it's actually set to is ignored. Function for retrieving the current setting for print on pass.
Definition at line 64 of file unittest.cc.
void UnitTest::printOnPass | ( | bool | newVal | ) |
Function for setting print on pass.
newVal | The new setting. |
Definition at line 65 of file unittest.cc.
unsigned UnitTest::printResults | ( | ) |
Function to call at the end of a test that prints an overall result and a summary of how many checks passed and failed.
main() should return the return value of this function which is the number of failed checks.
Definition at line 71 of file unittest.cc.
References cprintf().
void UnitTest::reset | ( | ) |
Zero the number of passes and failures so far.
Definition at line 79 of file unittest.cc.
void UnitTest::setCase | ( | const char * | newCase | ) |
Sets the current test case.
Test cases are used to group checks together and describe what that group is doing. Setting a new case defines the start of a new group and the end of the previous one. The case string is used in place and not copied, so don't modify or invalidate it until a new case label is installed.
newCase | The name of the new test case. |
Definition at line 86 of file unittest.cc.