Bitcoin Core 30.99.0
P2P Digital Currency
Classes | Macros | Typedefs | Functions
unit_test.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tf_test_entry
 
struct  tf_test_module
 
struct  tf_targets
 
struct  tf_args
 
struct  tf_framework
 

Macros

#define MAX_ARGS   150
 
#define MAX_SUBPROCESSES   16
 
#define CASE(name)   { #name, run_##name }
 
#define CASE1(name)   { #name, name }
 
#define MAKE_TEST_MODULE(name)
 
#define REPEAT_TEST(fn)   REPEAT_TEST_MULT(fn, 1)
 
#define REPEAT_TEST_MULT(fn, multiplier)
 

Typedefs

typedef void(* test_fn) (void)
 
typedef int(* setup_ctx_fn) (void)
 
typedef int(* teardown_fn) (void)
 
typedef void(* run_test_fn) (const struct tf_test_entry *)
 

Functions

static int tf_init (struct tf_framework *tf, int argc, char **argv)
 
static int tf_run (struct tf_framework *tf)
 

Macro Definition Documentation

◆ CASE

#define CASE (   name)    { #name, run_##name }

Definition at line 24 of file unit_test.h.

◆ CASE1

#define CASE1 (   name)    { #name, name }

Definition at line 25 of file unit_test.h.

◆ MAKE_TEST_MODULE

#define MAKE_TEST_MODULE (   name)
Value:
{ \
#name, \
tests_##name, \
sizeof(tests_##name) / sizeof(tests_##name[0]) \
}

Definition at line 27 of file unit_test.h.

◆ MAX_ARGS

#define MAX_ARGS   150

Definition at line 16 of file unit_test.h.

◆ MAX_SUBPROCESSES

#define MAX_SUBPROCESSES   16

Definition at line 18 of file unit_test.h.

◆ REPEAT_TEST

#define REPEAT_TEST (   fn)    REPEAT_TEST_MULT(fn, 1)

Definition at line 34 of file unit_test.h.

◆ REPEAT_TEST_MULT

#define REPEAT_TEST_MULT (   fn,
  multiplier 
)
Value:
static void fn(void) { \
int i; \
int repeat = COUNT * (multiplier); \
for (i = 0; i < repeat; i++) \
fn##_internal(); \
}
int COUNT
Definition: unit_test.c:23

Definition at line 35 of file unit_test.h.

Typedef Documentation

◆ run_test_fn

typedef void(* run_test_fn) (const struct tf_test_entry *)

Definition at line 64 of file unit_test.h.

◆ setup_ctx_fn

typedef int(* setup_ctx_fn) (void)

Definition at line 62 of file unit_test.h.

◆ teardown_fn

typedef int(* teardown_fn) (void)

Definition at line 63 of file unit_test.h.

◆ test_fn

typedef void(* test_fn) (void)

Definition at line 49 of file unit_test.h.

Function Documentation

◆ tf_init()

static int tf_init ( struct tf_framework tf,
int  argc,
char **  argv 
)
static

◆ tf_run()

static int tf_run ( struct tf_framework tf)
static