The test enabling class, allowing registration within the UnitTester. More...
Public Member Functions | |
TestClass () noexcept | |
TestClass (nkMemory::StringView name) noexcept | |
virtual | ~TestClass () |
FunctionSet & | getFunctionSet () |
const FunctionSet & | getFunctionSet () const |
std::function< bool()> | getClassInitFunction () const |
std::function< void()> | getClassShutdownFunction () const |
std::function< bool()> | getFunctionInitFunction () const |
std::function< void()> | getFunctionShutdownFunction () const |
nkMemory::StringView | getName () const |
bool | setClassInitFunction (std::function< bool()> func) |
bool | setClassShutdownFunction (std::function< void()> func) |
bool | setTestFunctionInitFunction (std::function< bool()> func) |
bool | setTestFunctionShutdownFunction (std::function< void()> func) |
void | setName (nkMemory::StringView value) |
void | execute (const TestRunParameters ¶meters) const |
The test enabling class, allowing registration within the UnitTester.
Implementing this class enables registering within the UnitTester for a run sequence. Utilities are provided within the class to ease the process.
An example of usage would be :
To avoid name conflicts, you can use the NS variant of the macros to register classes and their namespaces. However, in the case of using the NS variant, do not forget to close it using the corresponding macro, like so :
|
noexcept |
Default constructor.
|
noexcept |
Named constructor.
name | The name to attach to the class. |
|
virtual |
Destructor.
FunctionSet& nkDebug::TestClass::getFunctionSet | ( | ) |
Non-const variant of the getter.
const FunctionSet& nkDebug::TestClass::getFunctionSet | ( | ) | const |
Const variant of the getter.
std::function<bool ()> nkDebug::TestClass::getClassInitFunction | ( | ) | const |
std::function<void ()> nkDebug::TestClass::getClassShutdownFunction | ( | ) | const |
std::function<bool ()> nkDebug::TestClass::getFunctionInitFunction | ( | ) | const |
std::function<void ()> nkDebug::TestClass::getFunctionShutdownFunction | ( | ) | const |
nkMemory::StringView nkDebug::TestClass::getName | ( | ) | const |
bool nkDebug::TestClass::setClassInitFunction | ( | std::function< bool()> | func | ) |
Sets the callback called before the class runs all of its functions in a run.
func | The function to call. |
bool nkDebug::TestClass::setClassShutdownFunction | ( | std::function< void()> | func | ) |
Sets the callback called after all functions from the class have been run.
func | The function to call. |
bool nkDebug::TestClass::setTestFunctionInitFunction | ( | std::function< bool()> | func | ) |
Sets the callback called before each function run.
func | The function to call. |
bool nkDebug::TestClass::setTestFunctionShutdownFunction | ( | std::function< void()> | func | ) |
Sets the callback called after each function run.
func | The function to call. |
void nkDebug::TestClass::setName | ( | nkMemory::StringView | value | ) |
Sets the name attached to the class.
value | The name to attach. |
void nkDebug::TestClass::execute | ( | const TestRunParameters & | parameters | ) | const |
Requests the class to run all of its registered functions.
parameters | The run parameters. |