Jon Test
C++ Unit Test Tool. Not for production -- sample code only
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
JonTest::TestCase< TestSuiteDerived > Class Template Reference

Defines and runs a single Test Case within a Test Suite. More...

#include <TestCase.h>

Collaboration diagram for JonTest::TestCase< TestSuiteDerived >:
Collaboration graph

Public Types

typedef TestSuiteDerived TestSuite
 The actual Test Suite class.
 
typedef void(TestSuite::* TestCaseMethod) ()
 The actual Test Suite Method type for test cases.
 

Public Member Functions

 TestCase ()=default
 Default initializer for use in STL containers.
 
 TestCase (const TestCase &right)=default
 Default copy constructor for use in STL containers.
 
 TestCase (const char *const testCaseName, TestCaseMethod const testCaseMethod)
 Create Test Case by name for given testCaseMethod in TestSuite.
 
 ~TestCase ()
 Do nothing destructor.
 
bool run (TestSuite &suite, Logger &logger) const
 Run this Test Case as part of suite, logging events to logger.
 

Static Public Member Functions

static TestCase createAndAdd (TestSuite &suite, const char *const testCaseName, TestCaseMethod const testCaseMethod)
 Creates TestCase and adds the Test Case to the suite.
 

Public Attributes

std::string name
 Name of the Test Case.
 
TestCaseMethod testCaseMethod
 TestSuite method of the Test Case.
 

Detailed Description

template<typename TestSuiteDerived>
class JonTest::TestCase< TestSuiteDerived >

Defines and runs a single Test Case within a Test Suite.

Template Parameters
TestSuiteDerivedThe actual Test Suite class, required for pointer to member.

Definition at line 17 of file TestCase.h.

Member Typedef Documentation

◆ TestCaseMethod

typedef void(TestSuite::* JonTest::TestCase< TestSuiteDerived >::TestCaseMethod) ()

The actual Test Suite Method type for test cases.

Definition at line 24 of file TestCase.h.

◆ TestSuite

The actual Test Suite class.

Definition at line 21 of file TestCase.h.

Constructor & Destructor Documentation

◆ TestCase() [1/3]

JonTest::TestCase< TestSuiteDerived >::TestCase ( )
default

Default initializer for use in STL containers.

◆ TestCase() [2/3]

Default copy constructor for use in STL containers.

◆ TestCase() [3/3]

JonTest::TestCase< TestSuiteDerived >::TestCase ( const char *const  testCaseName,
TestCaseMethod const  testCaseMethod 
)
inline

Create Test Case by name for given testCaseMethod in TestSuite.

Parameters
testCaseNameName of the Test Case
testCaseMethodTestSuite method of the Test Case

Definition at line 54 of file TestCase.h.

◆ ~TestCase()

Do nothing destructor.

Definition at line 66 of file TestCase.h.

Member Function Documentation

◆ createAndAdd()

static TestCase JonTest::TestCase< TestSuiteDerived >::createAndAdd ( TestSuite suite,
const char *const  testCaseName,
TestCaseMethod const  testCaseMethod 
)
inlinestatic

Creates TestCase and adds the Test Case to the suite.

Parameters
suiteTest Suite to add this to
testCaseNameName of the Test Case
testCaseMethodTestSuite method of the Test Case

Definition at line 34 of file TestCase.h.

◆ run()

bool JonTest::TestCase< TestSuiteDerived >::run ( TestSuite suite,
Logger logger 
) const
inline

Run this Test Case as part of suite, logging events to logger.

Returns
true for pass, false for fail or error
Parameters
suiteTest Suite this Test Case belongs to
loggerReceiver of events from the execution of this Test Case

Definition at line 74 of file TestCase.h.

Member Data Documentation

◆ name

Name of the Test Case.

Definition at line 27 of file TestCase.h.

◆ testCaseMethod

TestSuite method of the Test Case.

Definition at line 30 of file TestCase.h.


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