Frobby  0.9.5
Public Member Functions | List of all members
TestCase Class Referenceabstract

Represents a test case, which is usually created through a macro that defines a subclass. More...

#include <TestCase.h>

Inheritance diagram for TestCase:
Test

Public Member Functions

 TestCase (const string &name)
 Construct a test case with the given name. More...
 
virtual bool accept (TestVisitor &visitor)
 Makes the visitor visit this object as per the Visitor Pattern. More...
 
virtual void run (const char *nameOfTest, bool printDots)=0
 Run the test and record the name of the test as __nameOfTest. More...
 
- Public Member Functions inherited from Test
 Test (const string &name)
 Construct a Test with the given name. More...
 
virtual ~Test ()
 
const string & getName () const
 Returns the name passed to the constructor. More...
 
bool operator< (const Test &test) const
 Compares names lexicographically. More...
 

Detailed Description

Represents a test case, which is usually created through a macro that defines a subclass.

This class is a leaf of the Composite Pattern, and can be visited by a TestVisitor according to the Visitor Pattern.

Definition at line 29 of file TestCase.h.

Constructor & Destructor Documentation

◆ TestCase()

TestCase::TestCase ( const string &  name)

Construct a test case with the given name.

Definition at line 22 of file TestCase.cpp.

Member Function Documentation

◆ accept()

bool TestCase::accept ( TestVisitor visitor)
virtual

Makes the visitor visit this object as per the Visitor Pattern.

Implements Test.

Definition at line 26 of file TestCase.cpp.

◆ run()

virtual void TestCase::run ( const char *  nameOfTest,
bool  printDots 
)
pure virtual

Run the test and record the name of the test as __nameOfTest.

This can be a more detailed name, and it can be derived from the name that is returned by getName(), or it can be unrelated. This provides needed flexibility. printDots indicates whether to print dots when individual assertions succeed.


The documentation for this class was generated from the following files: