Base module
test
Modern unit testing framework.
test
Modern unit testing framework.
Classes
| Name | Description |
|---|---|
FunctionTest | Test wrapper for standalone test functions. |
Test | Test wrapper class. |
TestRunner | Test manager queue. |
Typedefs
| Return | Name | Description |
|---|---|---|
std::list< Test * > | TestList | |
std::list< std::string > | SErrorist | |
std::map< Test *, SErrorist > | ErrorMap |
TestList
using TestList = std::list< Test * >SErrorist
using SErrorist = std::list< std::string >ErrorMap
using ErrorMap = std::map< Test *, SErrorist >Functions
| Return | Name | Description |
|---|---|---|
void | init | Initialize the test environment. |
int | finalize | Finalize the test environment. |
void | runAll | Run all tests. |
void | describe | Describe a test environment implemented by the given lambda function. |
void | describe | Describe a test environment implemented by the given test instance. |
void | expectImpl | Expect asserts that a condition is true (use expect() as defined below). |
bool | waitFor | 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. |
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 = 3000)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.
