Include this to use criterion.
More...
#include "types.h"
#include "assert.h"
#include "alloc.h"
#include "internal/test.h"
Go to the source code of this file.
|
#define | Test(Suite, Name, ...) internal |
|
#define | TestSuite(Name, ...) internal |
|
Include this to use criterion.
Definition in file criterion.h.
◆ Test
#define Test |
( |
| Suite, |
|
|
| Name, |
|
|
| ... ) internal |
Defines a new test.
- Parameters
-
Suite | The name of the test suite containing this test. |
Name | The name of the test. |
... | An optional sequence of designated initializer key/value pairs as described in the criterion_test_extra_data structure (see criterion/types.h).
Example: .exit_code = 1 |
Definition at line 45 of file criterion.h.
◆ TestSuite
#define TestSuite |
( |
| Name, |
|
|
| ... ) internal |
Explicitely defines a test suite and its options.
- Parameters
-
Name | The name of the test suite. |
... | An optional sequence of designated initializer key/value pairs as described in the criterion_test_extra_data structure (see criterion/types.h). These options will provide the defaults for each test. |
Definition at line 56 of file criterion.h.
◆ criterion_finalize()
Release all resources allocated by criterion.
Using any of the functions and macros provided by criterion except criterion_initialize after this function is called results in undefined behaviour.
◆ criterion_handle_args()
CR_API int criterion_handle_args |
( |
int | argc, |
|
|
char * | argv[], |
|
|
bool | handle_unknown_arg ) |
Handles all default command-line parameters, as documented in: http://criterion.readthedocs.org/en/latest/env.html, and appropriately sets criterion_options.
- Parameters
-
[in] | argc | The number of arguments in argv. |
[in] | argv | A null-terminated array of strings representing the arguments. |
[in] | handle_unknown_arg | Whether the function should print a message and exit when an unknown parameter is encountered. Use false if you want to handle additional parameters yourself. |
- Returns
- 0 if the process should exit immediately after, for instance after printing the help message.
◆ criterion_initialize()
Initializes criterion and builds a set of all discovered tests.
Using any of the functions and macros provided by criterion before calling this results in undefined behaviour.
- Returns
- the set of tests
◆ criterion_register_test()
Manually registers a new test within the specified test set.
- Parameters
-
[in] | tests | The set of tests you want to insert the test in. |
[in] | test | The newly created test. |
◆ criterion_run_all_tests()
Run all the tests in the test set.
- Parameters
-
[in] | tests | The set of tests that are to be executed. |
- Returns
- 1 if all tests succeeded or criterion_options.always_succeed is true, 0 otherwise.
◆ criterion_current_suite
◆ criterion_current_test