**µTest — A small C testing library**
- [Main](./mutest.md.html)
### Includes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Functions
#### `mutest_expect`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void
mutest_expect (const char *description,
mutest_expect_res_t *value,
mutest_matcher_func_t first_matcher,
...);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
description
: the description of an expectation
value
: the value to check
first_matcher
: a function used to match the expected value against `value`
...
: a `NULL`-terminated list of functions and values that will
match agains `value`
Defines a new expectation.
An expectation is satistied if `value` matches the expected value
of all the matcher functions.
----
#### `mutest_it`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void
mutest_it (const char *description,
mutest_spec_func_t func);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
description
: the description of a test specification
func
: the function that defines the specification
Describes a new test specification.
Specifications group various expectations; typically, you will use
[`mutest_expect()`](#//functions/mutest_expect) to define each
expectation that needs to be satisfied in order to pass the specification.
----
#### `mutest_describe`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void
mutest_describe (const char *description,
mutest_describe_func_t func);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
description
: the description of a test suite
func
: the function that defines the test suite
Describes a new test suite.
Test suites group various specification; typically, you will use
[`mutest_it()`](#//functions/mutest_it) to define each specification in
a suite.
Each test binary can contain multiple test suites.
### Types
#### `mutest_suite_t`
An opaque structure representing a test suite.
----
#### `mutest_spec_t`
An opaque structure representing a specification in a suite.
----
#### `mutest_expect_t`
An opaque structure representing an expectation in a specification.
----
#### `mutest_expect_res_t`
An opaque structure representing the result of an expectation.
---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
typedef void (* mutest_describe_func_t) (mutest_suite_t *suite)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The prototype of a function to pass to [`mutest_describe()`](#//functions/mutest_describe).
suite
: the test suite object
----
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void (* mutest_spec_func_t) (mutest_spec_t *spec)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The prototype of a function to pass to [`mutest_it()`](#//functions/mutest_it).
### Macros
**MUTEST_MAIN (\_C\_)**
: A convenience pre-processor macro that defines main entry point of the test
binary. This function will call `mutest_init()`, replace `_C_` with the body
of the function, and finally call `mutest_report()`.