Base module

test

Modern unit testing framework.

test

Modern unit testing framework.

Classes

NameDescription
FunctionTestTest wrapper for standalone test functions.
TestTest wrapper class.
TestRunnerTest manager queue.

Typedefs

ReturnNameDescription
std::list< Test * >TestList
std::list< std::string >SErrorist
std::map< Test *, SErrorist >ErrorMap

TestList

std::list< Test * > TestList()

SErrorist

std::list< std::string > SErrorist()

ErrorMap

std::map< Test *, SErrorist > ErrorMap()

Functions

ReturnNameDescription
voidinitInitialize the test environment.
intfinalizeFinalize the test environment.
voidrunAllRun all tests.
voiddescribeDescribe a test environment implemented by the given lambda function.
voiddescribeDescribe a test environment implemented by the given test instance.
voidexpectImplExpect asserts that a condition is true (use expect() as defined below).
boolwaitForRun the event loop until a condition is met or timeout expires. Returns true if the condition was satisfied, false on timeout. Useful for testing async operations that complete via libuv callbacks.

init

void init()

Initialize the test environment.


finalize

int finalize()

Finalize the test environment.

Destroy the TestRunner singleton instance and return the exit code.


runAll

void runAll()

Run all tests.


describe

void describe(const std::string & name, std::function< void()> target)

Describe a test environment implemented by the given lambda function.


describe

void describe(const std::string & name, Test * test)

Describe a test environment implemented by the given test instance.


expectImpl

void expectImpl(bool passed, const char * assert, const char * file, long line)

Expect asserts that a condition is true (use expect() as defined below).


waitFor

bool waitFor(std::function< bool()> condition, int timeoutMs)

Run the event loop until a condition is met or timeout expires. Returns true if the condition was satisfied, false on timeout. Useful for testing async operations that complete via libuv callbacks.