Base module

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

using TestList = std::list< Test * >

Type: std::list< Test * >

Defined in src/base/include/icy/test.h:34


SErrorist

using SErrorist = std::list< std::string >

Defined in src/base/include/icy/test.h:35


ErrorMap

using ErrorMap = std::map< Test *, SErrorist >

Type: std::map< Test *, SErrorist >

Defined in src/base/include/icy/test.h:36

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()

Defined in src/base/include/icy/test.h:39

Initialize the test environment.


finalize

int finalize()

Defined in src/base/include/icy/test.h:44

Finalize the test environment.

Destroy the TestRunner singleton instance and return the exit code.


runAll

void runAll()

Defined in src/base/include/icy/test.h:47

Run all tests.


describe

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

Defined in src/base/include/icy/test.h:50

Describe a test environment implemented by the given lambda function.


describe

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

Defined in src/base/include/icy/test.h:53

Describe a test environment implemented by the given test instance.


expectImpl

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

Defined in src/base/include/icy/test.h:56

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


waitFor

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

Defined in src/base/include/icy/test.h:61

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.