|
PicoTest
A minimalist unit testing framework for C programs
|
Test Case Hooks | |
PicoTest provides a way for client code to intercept test case events. This can be used for e.g. logging purpose or reporting. | |
| typedef void | PicoTestCaseEnterProc(const char *testName) |
| Function signature of test case enter hooks. | |
| typedef void | PicoTestCaseLeaveProc(const char *testName, int fail) |
| Function signature of test case leave hooks. | |
| #define | PICOTEST_CASE_ENTER_DEFAULT(testName) |
| Default test case enter hook. | |
| #define | PICOTEST_CASE_ENTER |
| Define the test case enter hook. | |
| #define | PICOTEST_CASE_LEAVE_DEFAULT(testName, fail) |
| Default test case enter hook. | |
| #define | PICOTEST_CASE_LEAVE |
| Define the test case leave hook. | |
Test Case Definitions | |
| #define | PICOTEST_CASE(...) |
| Test case declaration. | |
Test cases are the most elementary test functions. They are defined as simple functions blocks with assertions that checks the validity of the outcome.
| #define PICOTEST_CASE | ( | ... | ) |
Test case declaration.
This macro defines a PicoTestProc of the given name that can be called directly.
| _testName | Name of the test case. |
| _fixtureName | (optional) Name of the test fixture used by the test. |
| _context | (optional) Fixture context structure defined using PICOTEST_FIXTURE_CONTEXT(_fixtureName). |
| #define PICOTEST_CASE_ENTER_DEFAULT | ( | testName | ) |
| #define PICOTEST_CASE_ENTER |
Define the test case enter hook.
The default hook does nothing. Redefine this macro to use a custom hook, which must follow the PicoTestCaseEnterProc signature.
| #define PICOTEST_CASE_LEAVE_DEFAULT | ( | testName, | |
| fail ) |
| #define PICOTEST_CASE_LEAVE |
Define the test case leave hook.
The default hook does nothing. Redefine this macro to use a custom hook, which must follow the PicoTestCaseLeaveProc signature.
| typedef void PicoTestCaseEnterProc(const char *testName) |
Function signature of test case enter hooks.
Called before running the test case.
| testName | Test case name. |
| typedef void PicoTestCaseLeaveProc(const char *testName, int fail) |
Function signature of test case leave hooks.
Called after running the test case.
| testName | Test case name. |
| fail | Failed tests (including its subtests if any). |