Debian Codegraph @

subprojects/mutest/docs/mutest-general.md.html

raw
1 <meta charset="utf-8"><link rel="stylesheet" href="apidoc.css"/>
2
3 **µTest — A small C testing library**
4
5 - [Main](./mutest.md.html)
6
7 ### Includes
8
9 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 #include <mutest.h>
11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12
13 ### Functions
14
15 #### `mutest_expect`
16
17 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 void
19 mutest_expect (const char *description,
20 mutest_expect_res_t *value,
21 mutest_matcher_func_t first_matcher,
22 ...);
23 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24
25 description
26 : the description of an expectation
27 value
28 : the value to check
29 first_matcher
30 : a function used to match the expected value against `value`
31 ...
32 : a `NULL`-terminated list of functions and values that will
33 match agains `value`
34
35 Defines a new expectation.
36
37 An expectation is satistied if `value` matches the expected value
38 of all the matcher functions.
39
40 ----
41
42 #### `mutest_it`
43
44 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 void
46 mutest_it (const char *description,
47 mutest_spec_func_t func);
48 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49
50 description
51 : the description of a test specification
52 func
53 : the function that defines the specification
54
55 Describes a new test specification.
56
57 Specifications group various expectations; typically, you will use
58 [`mutest_expect()`](#//functions/mutest_expect) to define each
59 expectation that needs to be satisfied in order to pass the specification.
60
61 ----
62
63 #### `mutest_describe`
64
65 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66 void
67 mutest_describe (const char *description,
68 mutest_describe_func_t func);
69 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70
71 description
72 : the description of a test suite
73 func
74 : the function that defines the test suite
75
76 Describes a new test suite.
77
78 Test suites group various specification; typically, you will use
79 [`mutest_it()`](#//functions/mutest_it) to define each specification in
80 a suite.
81
82 Each test binary can contain multiple test suites.
83
84 ### Types
85
86 #### `mutest_suite_t`
87
88 An opaque structure representing a test suite.
89
90 ----
91
92 #### `mutest_spec_t`
93
94 An opaque structure representing a specification in a suite.
95
96 ----
97
98 #### `mutest_expect_t`
99
100 An opaque structure representing an expectation in a specification.
101
102 ----
103
104 #### `mutest_expect_res_t`
105
106 An opaque structure representing the result of an expectation.
107
108 ---
109
110 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111 typedef void (* mutest_describe_func_t) (mutest_suite_t *suite)
112 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113
114 The prototype of a function to pass to [`mutest_describe()`](#//functions/mutest_describe).
115
116 suite
117 : the test suite object
118
119 ----
120
121 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122 void (* mutest_spec_func_t) (mutest_spec_t *spec)
123 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124
125 The prototype of a function to pass to [`mutest_it()`](#//functions/mutest_it).
126
127 ### Macros
128
129 **MUTEST_MAIN (\_C\_)**
130 : A convenience pre-processor macro that defines main entry point of the test
131 binary. This function will call `mutest_init()`, replace `_C_` with the body
132 of the function, and finally call `mutest_report()`.
133
134 <style class="fallback">body{visibility:hidden}</style><script>markdeepOptions={tocStyle:'medium'};</script>
135 <!-- Markdeep: --><script src="markdeep.min.js" charset="utf-8"></script>