![]() |
Scrutiny
1.1.0
C testing framework for POSIX environments
|
Defines the runner functionality. More...
#include <stdbool.h>
#include <sys/types.h>
#include "definitions.h"
Go to the source code of this file.
Data Structures | |
struct | scrTestOptions |
Options to pass to scrAddTest. More... | |
struct | scrGroupOptions |
Options to pass to scrGroupCreate. More... | |
struct | scrOptions |
Options to pass to scrRun. More... | |
struct | scrStats |
Holds the test results. More... | |
Macros | |
#define | SCR_TF_XFAIL |
Indicates that a test is expected to fail. | |
#define | SCR_RF_FAIL_FAST |
Instructs the runner to stop as soon as a test fails. | |
#define | SCR_RF_VERBOSE |
Displays output even when tests pass. | |
Typedefs | |
typedef size_t | scrGroup |
A representation of a testing group. | |
typedef void | scrTestFn(void) |
The signature for a test function. | |
typedef struct scrTestOptions | scrTestOptions |
Options to pass to scrAddTest. | |
typedef void * | scrCtxCreateFn(void *) |
The signature for a group context creation function. | |
typedef void | scrCtxCleanupFn(void *) |
The signature for a group context cleanup function. | |
typedef struct scrGroupOptions | scrGroupOptions |
Options to pass to scrGroupCreate. | |
typedef struct scrOptions | scrOptions |
Options to pass to scrRun. | |
typedef struct scrStats | scrStats |
Holds the test results. | |
Functions | |
scrGroup | scrGroupCreate (const scrGroupOptions *options) SCR_EXPORT |
Creates a new test group. More... | |
void | scrAddTest (scrGroup group, const char *name, scrTestFn test_fn, const scrTestOptions *options) SCR_EXPORT SCR_NONNULL(2 |
Adds a test to a group. More... | |
bool | scrPatchFunction (scrGroup group, const char *func_name, const char *file_substring, void *new_func) SCR_EXPORT SCR_NONNULL(2 |
Enables monkeypatching of a function for all of a group's tests. More... | |
int | scrRun (const scrOptions *options, scrStats *stats) SCR_EXPORT |
Runs all of the tests. More... | |
Defines the runner functionality.
scrGroup scrGroupCreate | ( | const scrGroupOptions * | options | ) |
Creates a new test group.
options | A pointer to the options to use. If NULL, then default options will be used. |
void scrAddTest | ( | scrGroup | group, |
const char * | name, | ||
scrTestFn | test_fn, | ||
const scrTestOptions * | options | ||
) |
Adds a test to a group.
group | The group handle. |
name | The name of the test. |
test_fn | The test function. |
options | A pointer to the options to use. If NULL, then default options will be used. |
bool scrPatchFunction | ( | scrGroup | group, |
const char * | func_name, | ||
const char * | file_substring, | ||
void * | new_func | ||
) |
Enables monkeypatching of a function for all of a group's tests.
group | The group handle. |
func_name | The name of the function to patch. |
file_substring | If not NULL, then only files containing this value as a substring will be patched. |
new_func | The new function to use. |
int scrRun | ( | const scrOptions * | options, |
scrStats * | stats | ||
) |
Runs all of the tests.
options | A pointer to options to use. If NULL, then default options will be used. | |
[out] | stats | If not NULL, then will be populated with the run's statistics. |