asrt
Automated System Runtime Testing library
Loading...
Searching...
No Matches
diag.h
1
12
13#ifndef ASRTR_DIAG_H
14#define ASRTR_DIAG_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#include "../asrtl/chann.h"
21#include "../asrtl/diag_proto.h"
22#include "../asrtl/log.h"
23#include "../asrtl/util.h"
24
28{
29 struct asrt_node node;
30 struct asrt_diag_record_msg msg;
31};
32
33typedef void ( *asrt_diag_record_done_cb )( void* ptr, enum asrt_status status );
34
35enum asrt_diag_record_result
36{
37 ASRT_DIAG_RECORD_ACCEPTED = 0,
38 ASRT_DIAG_RECORD_BUSY = 1,
39};
40
42enum asrt_status asrt_diag_client_init( struct asrt_diag_client* diag, struct asrt_node* prev );
43
46enum asrt_diag_record_result asrt_diag_client_record(
47 struct asrt_diag_client* diag,
48 char const* file,
49 uint32_t line,
50 char const* extra,
51 asrt_diag_record_done_cb done_cb,
52 void* done_ptr );
54void asrt_diag_client_deinit( struct asrt_diag_client* diag );
55
58
59#ifndef ASRT_FILENAME
60
61#if defined( __FILE_NAME__ )
62#define ASRT_FILENAME __FILE_NAME__
63#else
64#error "ASRT_FILENAME not defined and __FILE_NAME__ is unavailable on this compiler"
65#endif
66
67#endif
68
70#define ASRT_CHECK( diag, rec, x ) \
71 do { \
72 if ( !( x ) ) { \
73 ( rec )->state = ASRT_TEST_FAIL; \
74 asrt_diag_client_record( \
75 ( diag ), ASRT_FILENAME, __LINE__, #x, NULL, NULL ); \
76 } \
77 } while ( 0 )
78
80#define ASRT_REQUIRE( diag, rec, x ) \
81 do { \
82 if ( !( x ) ) { \
83 ( rec )->state = ASRT_TEST_FAIL; \
84 asrt_diag_client_record( \
85 ( diag ), ASRT_FILENAME, __LINE__, #x, NULL, NULL ); \
86 return ASRT_SUCCESS; \
87 } \
88 } while ( 0 )
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif // ASRTR_DIAG_H
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: diag.h:28
Definition: diag_proto.h:30
A node in a doubly-linked channel chain.
Definition: chann.h:122