gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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

#define EXPECT_EQ (   lhs,
  rhs 
)
Value:
UnitTest::checkVal(__FILE__, __LINE__, \
"EXPECT_EQ(" #lhs ", " #rhs ")", (lhs) == (rhs));
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:51

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

Definition at line 112 of file unittest.hh.

Referenced by main().

#define EXPECT_FALSE (   expr)
Value:
UnitTest::checkVal(__FILE__, __LINE__, \
"EXPECT_FALSE(" #expr ")", (expr) == false)
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:51

A macro which verifies that expr evaluates to false.

Definition at line 108 of file unittest.hh.

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

A macro which verifies that expr evaluates to true.

Definition at line 105 of file unittest.hh.

Referenced by main().


Generated on Fri Jun 9 2017 13:03:59 for gem5 by doxygen 1.8.6