asrt
Automated System Runtime Testing library
Loading...
Searching...
No Matches
record.h
1
12#ifndef ASRT_RECORD_H
13#define ASRT_RECORD_H
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#include "../asrtl/status.h"
20
21#include <stdint.h>
22
24enum asrt_test_state
25{
26 ASRT_TEST_INIT = 1,
27 ASRT_TEST_RUNNING = 2,
28 ASRT_TEST_ERROR = 3,
29 ASRT_TEST_FAIL = 4,
30 ASRT_TEST_PASS = 5,
31};
32
33struct asrt_record;
34typedef enum asrt_status ( *asrt_test_callback )( struct asrt_record* );
35
38{
39 void* test_ptr;
40 asrt_test_callback continue_f;
41 uint32_t run_id;
42};
43
46{
47 enum asrt_test_state state;
48
49 struct asrt_test_input const* inpt;
50};
51
53#define ASRT_RECORD_CHECK( rec, x ) \
54 do { \
55 if ( !( x ) ) \
56 ( rec )->state = ASRT_TEST_FAIL; \
57 } while ( 0 )
58
60#define ASRT_RECORD_REQUIRE( rec, x ) \
61 do { \
62 if ( !( x ) ) { \
63 ( rec )->state = ASRT_TEST_FAIL; \
64 return ASRT_SUCCESS; \
65 } \
66 } while ( 0 )
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif
Mutable test state passed to the test entry point on every tick.
Definition: record.h:46
struct asrt_test_input const * inpt
Immutable per-invocation context.
Definition: record.h:49
enum asrt_test_state state
Current state; updated by assertions and by the reactor.
Definition: record.h:47
Per-invocation context forwarded to the test entry point.
Definition: record.h:38
void * test_ptr
Context pointer registered with asrt_test_init().
Definition: record.h:39
asrt_test_callback continue_f
Entry point to call on each tick.
Definition: record.h:40
uint32_t run_id
Unique run token from the controller.
Definition: record.h:41