API Documentation
Static Public Member Functions | List of all members
nkDebug::UnitTester Class Referencefinal

Core of the component's testing capabilities. More...

Static Public Member Functions

static TestClassregisterTestClass (std::function< TestClass *()> factoryFunction)
 
static nkMemory::BufferCast< TestClass * > getRegisteredClasses (nkMemory::StringView filter="")
 
static unsigned int getRegisteredTestClassCount ()
 
static void run (const TestRunParameters &parameters=TestRunParameters())
 
static nkMemory::BufferCast< TestClass * > getAllTests ()
 

Detailed Description

Core of the component's testing capabilities.

This class allows to statically register TestClass entries, to then run a test sequence. Typically, the testing classes are registered as the program launches through static calls. Macros are provided as part of a TestClass to ease the development and hide this registering requirement.

Client can then initiate a testing sequence with the run() method, specifying any required parameter.

Member Function Documentation

◆ registerTestClass()

static TestClass* nkDebug::UnitTester::registerTestClass ( std::function< TestClass *()>  factoryFunction)
static

Registers a class, for it to be called during a run sequence if conditions allow.

Parameters
factoryFunctionThe factory function for the testing class.
Returns
An instance of the testing class, created through the factory parameter.

◆ getRegisteredClasses()

static nkMemory::BufferCast<TestClass*> nkDebug::UnitTester::getRegisteredClasses ( nkMemory::StringView  filter = "")
static

Allows to retrieve a subset of the registered classes satisfying a filter on their names.

Parameters
filterThe filter to filter the names with, in an ECMA script regex format.
Returns
The subset satisfying the filter.

◆ getRegisteredTestClassCount()

static unsigned int nkDebug::UnitTester::getRegisteredTestClassCount ( )
static
Returns
The number of registered classes.

◆ run()

static void nkDebug::UnitTester::run ( const TestRunParameters parameters = TestRunParameters())
static

Runs a sequence of tests over the registered set of classes.

Parameters
parametersParameters to drive the sequence run.

◆ getAllTests()

static nkMemory::BufferCast<TestClass*> nkDebug::UnitTester::getAllTests ( )
static
Returns
All the registered tests.

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