Function prototypes, macros, and typedefs for unitc.
More...
Go to the source code of this file.
Function prototypes, macros, and typedefs for unitc.
A uc_suite carries specified options, tests, successes/failures, and comments of a test suite.
void uc_add_test |
( |
uc_suite |
suite, |
|
|
void(*)(uc_suite suite) |
test_func, |
|
|
const char * |
name, |
|
|
const char * |
comment |
|
) |
| |
Add a test to suite to be executed when run_test is called on the same suite.
- Parameters
-
suite | Test suite to add the test to. |
test_func | Test to execute. A test is a collection of uc_checks. test takes in a uc_suite which is the instance used in calling uc_check within test. suite will be passed to it. |
name | Name of the test - to appear in reports. Defaults to "Test #" where # depends on it's position in the queue if NULL. |
comment | A description of the test - to appear in reports. Can be omitted by passing NULL. |
bool uc_all_tests_passed |
( |
uc_suite |
suite | ) |
|
Check if all tests run for suite have passed (i.e. all checks were successful).
- Parameters
-
suite | Test suite to check. |
- Returns
- true if all tests that have been run for suite have passed (this includes "dangling" checks), false otherwise. Returns true if no tests or checks have been run.
void uc_check |
( |
uc_suite |
suite, |
|
|
const bool |
cond, |
|
|
const char * |
comment |
|
) |
| |
Check whether an expression evaluates as expected. Does nothing if suite is NULL.
- Parameters
-
suite | Test suite in which the check belongs to. |
cond | The condition to check - a check is deemed successful when cond evaluates to true. |
comment | Information about what is being checked. No other information about a check is available in (applicable) reports. Can be omitted by passing NULL. |
Free a test suite. Using suite after this call results in undefined behaviour. Does nothing if suite is NULL.
- Parameters
-
uc_suite uc_init |
( |
const uint_least8_t |
options, |
|
|
const char * |
name, |
|
|
const char * |
comment |
|
) |
| |
Create a test suite with the specified options.
- Parameters
-
options | Logical OR of values prefixed with UC_OPT. |
name | Name of the suite - to appear as the title of reports. Defaults to 'Main' if NULL. |
comment | A description of the suite - to appear as a complement to name. Can be omitted by passing NULL. |
- Returns
- A uc_suite with options specified by options or NULL on error.
Outputs a report showing suite's title, comment, and the number of successful checks vs. failed checks as a fraction. Outputs nothing if suite is NULL.
Example: Suite name Some information about the suite. Successful checks: 5/20.
- Parameters
-
suite | Test suite to generate report from. |
void uc_report_standard |
( |
uc_suite |
suite | ) |
|
Outputs a report showing suite's title, comment, the number of successful checks vs. failed checks as a fraction, and all comments of failed checks. Outputs nothing if suite is NULL. Example (the 'Check #8.' is auto generated when no comment is provided): Suite name Some information about the suite. Successful checks: 17/20. Check failed: A comment Check failed: Another comment. Check failed: Check #8.
- Parameters
-
suite | Test suite to generate report from. |
Run all tests added by uc_add_test (in order they were added in).
- Parameters
-
suite | Test suite to run tests for. |