|
PicoTest
A minimalist unit testing framework for C programs
|
Test Suite Hooks | |
PicoTest provides a way for client code to intercept test execution events on test suites and their subtests. This can be used for e.g. logging purpose or reporting. | |
| typedef void | PicoTestSuiteEnterProc(const char *suiteName, int nb) |
| Function signature of test suite enter hooks. | |
| typedef void | PicoTestSuiteLeaveProc(const char *suiteName, int nb, int fail) |
| Function signature of test suite leave hooks. | |
| typedef void | PicoTestSuiteBeforeSubtestProc(const char *suiteName, int nb, int fail, int index, const char *testName) |
| Function signature of test suite before subtest hooks. | |
| typedef void | PicoTestSuiteAfterSubtestProc(const char *suiteName, int nb, int fail, int index, const char *testName, int sfail) |
| Function signature of test suite after subtest hooks. | |
| #define | PICOTEST_SUITE_ENTER_DEFAULT(suiteName, nb) |
| Default test suite enter hook. | |
| #define | PICOTEST_SUITE_ENTER |
| Define the test suite enter hook. | |
| #define | PICOTEST_SUITE_LEAVE_DEFAULT(suiteName, nb, fail) |
| Default test suite leave hook. | |
| #define | PICOTEST_SUITE_LEAVE |
| Define the test suite leave hook. | |
| #define | PICOTEST_SUITE_BEFORE_SUBTEST_DEFAULT(suiteName, nb, fail, index, testName) |
| Default test suite before subtest hook. | |
| #define | PICOTEST_SUITE_BEFORE_SUBTEST |
| Define the test suite before subset hook. | |
| #define | PICOTEST_SUITE_AFTER_SUBTEST_DEFAULT(suiteName, nb, fail, index, testName, sfail) |
| Default test suite after subtest hook. | |
| #define | PICOTEST_SUITE_AFTER_SUBTEST |
| Define the test suite after subset hook. | |
Test Suite Definitions | |
| #define | PICOTEST_SUITE(_suiteName, ...) |
| Test suite declaration. | |
A test suite is a set of subtests in no special order. These subtests can themselves be test suites or test cases.
| #define PICOTEST_SUITE | ( | _suiteName, | |
| ... ) |
Test suite declaration.
A test suite is a test function that is made of one or several subtests.
This macro defines a PicoTestProc of the given name that can be called directly.
| _suiteName | Name of the test suite. |
| ... | Names of the subtests in the suite. |
| #define PICOTEST_SUITE_ENTER_DEFAULT | ( | suiteName, | |
| nb ) |
| #define PICOTEST_SUITE_ENTER |
Define the test suite enter hook.
The default hook does nothing. Redefine this macro to use a custom hook, which must follow the PicoTestSuiteEnterProc signature.
| #define PICOTEST_SUITE_LEAVE_DEFAULT | ( | suiteName, | |
| nb, | |||
| fail ) |
| #define PICOTEST_SUITE_LEAVE |
Define the test suite leave hook.
Called after running all subtests.
The default hook does nothing. Redefine this macro to use a custom hook, which must follow the PicoTestSuiteLeaveProc signature.
| #define PICOTEST_SUITE_BEFORE_SUBTEST_DEFAULT | ( | suiteName, | |
| nb, | |||
| fail, | |||
| index, | |||
| testName ) |
Default test suite before subtest hook.
Does nothing.
| #define PICOTEST_SUITE_BEFORE_SUBTEST |
Define the test suite before subset hook.
The default hook does nothing. Redefine this macro to use a custom hook, which must follow the PicoTestSuiteBeforeSubtestProc signature.
| #define PICOTEST_SUITE_AFTER_SUBTEST_DEFAULT | ( | suiteName, | |
| nb, | |||
| fail, | |||
| index, | |||
| testName, | |||
| sfail ) |
Default test suite after subtest hook.
Does nothing.
| #define PICOTEST_SUITE_AFTER_SUBTEST |
Define the test suite after subset hook.
The default hook does nothing. Redefine this macro to use a custom hook, which must follow the PicoTestSuiteAfterSubtestProc signature.
| typedef void PicoTestSuiteEnterProc(const char *suiteName, int nb) |
Function signature of test suite enter hooks.
Called before running the first subtest.
| suiteName | Test suite name. |
| nb | Number of subtests. |
| typedef void PicoTestSuiteLeaveProc(const char *suiteName, int nb, int fail) |
Function signature of test suite leave hooks.
| suiteName | Test suite name. |
| nb | Number of subtests. |
| fail | Number of failed subtests (including the subtests' subtests if any). |
| typedef void PicoTestSuiteBeforeSubtestProc(const char *suiteName, int nb, int fail, int index, const char *testName) |
Function signature of test suite before subtest hooks.
Called before running each subtest.
| suiteName | Test suite name. |
| nb | Number of subtests. |
| fail | Failed test suite subtests so far (including its subtests' subtests if any). |
| index | Index of subtest. |
| testName | Name of subtest. |
| typedef void PicoTestSuiteAfterSubtestProc(const char *suiteName, int nb, int fail, int index, const char *testName, int sfail) |
Function signature of test suite after subtest hooks.
Called before running each subtest.
| suiteName | Test suite name. |
| nb | Number of subtests. |
| fail | Failed test suite subtests so far (including its subtests' subtests if any). |
| index | Index of subtest. |
| testName | Name of subtest. |
| sfail | The subtest's failed tests (including its subtests if any). |