gem5  v20.1.0.0
Namespaces | Macros | Functions
unittest.hh File Reference

Go to the source code of this file.

Namespaces

 UnitTest
 

Macros

#define EXPECT_TRUE(expr)   UnitTest::checkVal(__FILE__, __LINE__, "EXPECT_TRUE(" #expr ")", (expr))
 A macro which verifies that expr evaluates to true. More...
 
#define EXPECT_FALSE(expr)
 A macro which verifies that expr evaluates to false. More...
 
#define EXPECT_EQ(lhs, rhs)
 A macro which verifies that lhs and rhs are equal to each other. More...
 

Functions

void UnitTest::checkVal (const char *file, const unsigned line, const char *test, const bool result)
 Function that actually handles checking whether an EXPECT_* passed. More...
 
bool UnitTest::printOnPass ()
 Print on pass is a switch that specifies whether to print a message even when a check passes. More...
 
void UnitTest::printOnPass (bool newVal)
 Function for setting print on pass. More...
 
unsigned UnitTest::passes ()
 Function that returns the current number of passed checks. More...
 
unsigned UnitTest::failures ()
 Function that returns the current number of failed checks. More...
 
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. More...
 
void UnitTest::reset ()
 Zero the number of passes and failures so far. More...
 
void UnitTest::setCase (const char *newCase)
 Sets the current test case. More...
 

Macro Definition Documentation

◆ EXPECT_EQ

#define EXPECT_EQ (   lhs,
  rhs 
)
Value:
UnitTest::checkVal(__FILE__, __LINE__, \
"EXPECT_EQ(" #lhs ", " #rhs ")", (lhs) == (rhs));

A macro which verifies that lhs and rhs are equal to each other.

Definition at line 110 of file unittest.hh.

◆ EXPECT_FALSE

#define EXPECT_FALSE (   expr)
Value:
UnitTest::checkVal(__FILE__, __LINE__, \
"EXPECT_FALSE(" #expr ")", (expr) == false)

A macro which verifies that expr evaluates to false.

Definition at line 106 of file unittest.hh.

◆ EXPECT_TRUE

#define EXPECT_TRUE (   expr)    UnitTest::checkVal(__FILE__, __LINE__, "EXPECT_TRUE(" #expr ")", (expr))

A macro which verifies that expr evaluates to true.

Definition at line 103 of file unittest.hh.

UnitTest::checkVal
void checkVal(const char *file, const unsigned line, const char *test, const bool result)
Function that actually handles checking whether an EXPECT_* passed.
Definition: unittest.cc:49

Generated on Wed Sep 30 2020 14:02:19 for gem5 by doxygen 1.8.17