54 #ifndef __UNITRAZER_H__
55 #define __UNITRAZER_H__
62 #ifdef __UNITRAZER_LIB__
63 #include "unitrzlib.h"
79 #define sm_init() unitrazer_start()
85 #define sm_cleanup() unitrazer_cleanup()
92 #define sm_verify() unitrazer_verify()
97 #define sm_init_expect(initState) \
98 unitrazer_sm_init_expect(__LINE__, initState)
100 #define unitrazer_sm_init_expect(line, initState) \
101 unitrazer_expect_wSymArg(line, RKH_TE_SM_INIT, 1, initState)
103 #define sm_init_expectAnyArgs() \
104 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_INIT)
107 #define sm_clrh_expect(historyState) \
108 unitrazer_sm_clrh_expect(__LINE__, historyState)
110 #define unitrazer_sm_clrh_expect(line, historyState) \
111 unitrazer_expect_wSymArg(line, RKH_TE_SM_CLRH, 1, historyState)
113 #define sm_clrh_expectAnyArgs() \
114 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_CLRH)
117 #define sm_trn_expect(sourceState, targetState) \
118 unitrazer_sm_trn_expect(__LINE__, sourceState, targetState)
120 #define unitrazer_sm_trn_expect(line, sourceState, targetState) \
121 unitrazer_expect_wSymArg(line, RKH_TE_SM_TRN, 2, sourceState, targetState)
123 #define sm_trn_expectAnyArgs() \
124 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_TRN)
127 #define sm_state_expect(nextState) \
128 unitrazer_sm_state_expect(__LINE__, nextState)
130 #define unitrazer_sm_state_expect(line, nextState) \
131 unitrazer_expect_wSymArg(line, RKH_TE_SM_STATE, 1, nextState)
133 #define sm_state_expectAnyArgs() \
134 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_STATE)
137 #define sm_enstate_expect(entryState) \
138 unitrazer_enstate_expect(__LINE__, entryState)
140 #define unitrazer_enstate_expect(line, entryState) \
141 unitrazer_expect_wSymArg(line, RKH_TE_SM_ENSTATE, 1, entryState)
143 #define sm_enstate_expectAnyArgs() \
144 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_ENSTATE)
147 #define sm_exstate_expect(exitState) \
148 unitrazer_exstate_expect(__LINE__, exitState)
150 #define unitrazer_exstate_expect(line, exitState) \
151 unitrazer_expect_wSymArg(line, RKH_TE_SM_EXSTATE, 1, exitState)
153 #define sm_exstate_expectAnyArgs() \
154 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_EXSTATE)
157 #define sm_nenex_expect(nEntry, nExit) \
158 unitrazer_sm_nenex_expect(__LINE__, nEntry, nExit)
160 #define unitrazer_sm_nenex_expect(line, nEntry, nExit) \
161 unitrazer_expect_wNumArg(line, RKH_TE_SM_NENEX, 2, nEntry, nExit)
163 #define sm_nenex_expectAnyArgs() \
164 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_NENEX)
167 #define sm_ntrnact_expect(nActions, nSegments) \
168 unitrazer_sm_ntrnact_expect(__LINE__, nActions, nSegments)
170 #define unitrazer_sm_ntrnact_expect(line, nActions, nSegments) \
171 unitrazer_expect_wNumArg(line, RKH_TE_SM_NTRNACT, 2, nActions, nSegments)
173 #define sm_ntrnact_expectAnyArgs() \
174 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_NTRNACT)
177 #define sm_tsState_expect(targetState) \
178 unitrazer_sm_tsState_expect(__LINE__, targetState)
180 #define unitrazer_sm_tsState_expect(line, targetState) \
181 unitrazer_expect_wSymArg(line, RKH_TE_SM_TS_STATE, 1, targetState)
183 #define sm_tsState_expectAnyArgs() \
184 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_TS_STATE)
187 #define sm_evtProc_expect() \
188 unitrazer_sm_evtProc_expect(__LINE__)
190 #define unitrazer_sm_evtProc_expect(line) \
191 unitrazer_expect_noArgs(line, RKH_TE_SM_EVT_PROC)
194 #define sm_evtNotFound_expect(signal) \
195 unitrazer_sm_evtNotFound_expect(__LINE__, signal)
197 #define unitrazer_sm_evtNotFound_expect(line, signal) \
198 unitrazer_expect_wSig(line, RKH_TE_SM_EVT_NFOUND, signal)
200 #define sm_evtNotFound_expectAnyArgs() \
201 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_EVT_NFOUND)
204 #define sm_grdFalse_expect() \
205 unitrazer_sm_grdFalse_expect(__LINE__)
207 #define unitrazer_sm_grdFalse_expect(line) \
208 unitrazer_expect_noArgs(line, RKH_TE_SM_GRD_FALSE)
211 #define sm_cndNotFound_expect() \
212 unitrazer_sm_cndNotFound_expect(__LINE__)
214 #define unitrazer_sm_cndNotFound_expect(line) \
215 unitrazer_expect_noArgs(line, RKH_TE_SM_CND_NFOUND)
218 #define sm_unknState_expect() \
219 unitrazer_sm_unknState_expect(__LINE__)
221 #define unitrazer_sm_unknState_expect(line) \
222 unitrazer_expect_noArgs(line, RKH_TE_SM_UNKN_STATE)
225 #define sm_exHLevel_expect() \
226 unitrazer_sm_exHLevel_expect(__LINE__)
228 #define unitrazer_sm_exHLevel_expect(line) \
229 unitrazer_expect_noArgs(line, RKH_TE_SM_EX_HLEVEL)
232 #define sm_exTSeg_expect() \
233 unitrazer_sm_exTSeg_expect(__LINE__)
235 #define unitrazer_sm_exTSeg_expect(line) \
236 unitrazer_expect_noArgs(line, RKH_TE_SM_EX_TSEG)
239 #define sm_exeAct_expect(actType, state, action) \
240 unitrazer_sm_exeAct_expect(__LINE__, actType, state, action)
242 #define sm_exeAct_expectAnyArgs() \
243 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_EXE_ACT)
246 #define sm_dch_expect(signal, state) \
247 unitrazer_sm_dch_expect(__LINE__, signal, state)
249 #define sm_dch_expectAnyArgs() \
250 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_DCH)
255 #define sm_init_ignore() \
256 unitrazer_ignore(__LINE__, RKH_TE_SM_INIT)
259 #define sm_clrh_ignore() \
260 unitrazer_ignore(__LINE__, RKH_TE_SM_CLRH)
263 #define sm_trn_ignore() \
264 unitrazer_ignore(__LINE__, RKH_TE_SM_TRN)
266 #define sm_trn_ignoreArg_sourceState() \
267 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_TRN, UT_ARGNO_1)
269 #define sm_trn_ignoreArg_targetState() \
270 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_TRN, UT_ARGNO_2)
273 #define sm_state_ignore() \
274 unitrazer_ignore(__LINE__, RKH_TE_SM_STATE)
277 #define sm_enstate_ignore() \
278 unitrazer_ignore(__LINE__, RKH_TE_SM_ENSTATE)
281 #define sm_exstate_ignore() \
282 unitrazer_ignore(__LINE__, RKH_TE_SM_EXSTATE)
285 #define sm_nenex_ignore() \
286 unitrazer_ignore(__LINE__, RKH_TE_SM_NENEX)
288 #define sm_nenex_ignoreArg_nEntry() \
289 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NENEX, UT_ARGNO_1)
291 #define sm_nenex_ignoreArg_nExit() \
292 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NENEX, UT_ARGNO_2)
295 #define sm_ntrnact_ignore() \
296 unitrazer_ignore(__LINE__, RKH_TE_SM_NTRNACT)
298 #define sm_ntrnact_ignoreArg_nActions() \
299 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NTRNACT, UT_ARGNO_1)
301 #define sm_ntrnact_ignoreArg_nSegments() \
302 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NTRNACT, UT_ARGNO_2)
305 #define sm_tsState_ignore() \
306 unitrazer_ignore(__LINE__, RKH_TE_SM_TS_STATE)
309 #define sm_evtProc_ignore() \
310 unitrazer_ignore(__LINE__, RKH_TE_SM_EVT_PROC)
313 #define sm_evtNotFound_ignore() \
314 unitrazer_ignore(__LINE__, RKH_TE_SM_EVT_NFOUND)
317 #define sm_grdFalse_ignore() \
318 unitrazer_ignore(__LINE__, RKH_TE_SM_GRD_FALSE)
321 #define sm_cndNotFound_ignore() \
322 unitrazer_ignore(__LINE__, RKH_TE_SM_CND_NFOUND)
325 #define sm_unknState_ignore() \
326 unitrazer_ignore(__LINE__, RKH_TE_SM_UNKN_STATE)
329 #define sm_exHLevel_ignore() \
330 unitrazer_ignore(__LINE__, RKH_TE_SM_EX_HLEVEL)
333 #define sm_exTSeg_ignore() \
334 unitrazer_ignore(__LINE__, RKH_TE_SM_EX_TSEG)
337 #define sm_exeAct_ignore() \
338 unitrazer_ignore(__LINE__, RKH_TE_SM_EXE_ACT)
340 #define sm_exeAct_ignoreArg_actType() \
341 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_EXE_ACT, UT_ARGNO_1)
343 #define sm_exeAct_ignoreArg_state() \
344 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_EXE_ACT, UT_ARGNO_2)
346 #define sm_exeAct_ignoreArg_action() \
347 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_EXE_ACT, UT_ARGNO_3)
350 #define sm_dch_ignore() \
351 unitrazer_ignore(__LINE__, RKH_TE_SM_DCH)
353 #define sm_dch_ignoreArg_signal() \
354 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_DCH, UT_ARGNO_1)
356 #define sm_dch_ignoreArg_state() \
357 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_DCH, UT_ARGNO_2)
362 #define mp_ignore() \
363 unitrazer_ignoreGroup(__LINE__, RKH_TG_MP)
366 #define sma_ignore() \
367 unitrazer_ignoreGroup(__LINE__, RKH_TG_SMA)
370 #define fwk_ignore() \
371 unitrazer_ignoreGroup(__LINE__, RKH_TG_FWK)
374 #define sm_ignore() \
375 unitrazer_ignoreGroup(__LINE__, RKH_TG_SM)
379 #define UT_ARGNO_1 (rui8_t)0
380 #define UT_ARGNO_2 (rui8_t)1
381 #define UT_ARGNO_3 (rui8_t)2
382 #define UT_ARGNO_4 (rui8_t)3
383 #define UT_ARGNO_5 (rui8_t)4
384 #define UT_ARGNO_6 (rui8_t)5
386 #define UT_SIZEOF_MSG 256
391 UT_PROC_SUCCESS, UT_PROC_FAIL, UT_PROC_BUSY, UT_PROC_INIT
394 typedef struct UtrzProcessOut UtrzProcessOut;
396 struct UtrzProcessOut
399 char msg[UT_SIZEOF_MSG];
401 UNITY_LINE_TYPE line;
408 UtrzProcessOut * unitrazer_getLastOut(
void);
409 void unitrazer_resetOut(
void);
410 void unitrazer_log_start(
void);
525 rui8_t actType,
RKH_ST_T *state,
void * action);
RKH framwwork platform - independent interface.
rui8_t RKH_TG_T
Group of events.
rui8_t RKH_TE_ID_T
Describes a trace event identification (ID).
Describes the common properties of regular states (basic, composite, and submachine).
void unitrazer_expectAnyArgs(UNITY_LINE_TYPE cmockLine, rui8_t trcEvt)
Expect a specific trace event regardless its arguments.
void unitrazer_ignoreArg(UNITY_LINE_TYPE cmockLine, rui8_t trcEvt, rui8_t noArg)
Adds the ability to specify specifc arguments to ignore for a produced trace event,...
void unitrazer_expect_noArgs(UNITY_LINE_TYPE cmockLine, RKH_TE_ID_T trcEvt)
Identifies the trace event to expect without arguments.
void unitrazer_ignore(UNITY_LINE_TYPE cmockLine, rui8_t trcEvt)
Ignore a specific trace event.
void unitrazer_ignoreGroup(UNITY_LINE_TYPE cmockLine, RKH_TG_T group)
Force to ignore every produced trace event from a specifc trace group.
void unitrazer_expect_wSig(UNITY_LINE_TYPE cmockLine, RKH_TE_ID_T trcEvt, RKH_SIG_T signal)
Identifies the trace event to expect and one signal argument.
void unitrazer_verify(void)
Makes sure there are no unused expectations, if there are, this function causes the test to fail.
void unitrazer_expect_wNumArg(UNITY_LINE_TYPE cmockLine, RKH_TE_ID_T trcEvt, rui8_t nArgs,...)
Identifies the trace event to expect with one or more arguments.
void unitrazer_start(void)
Establish the preconditions to the tests.
void unitrazer_sm_dch_expect(UNITY_LINE_TYPE cmockLine, RKH_SIG_T signal, RKH_ST_T *state)
Expect for RKH_TE_SM_DCH trace event.
void unitrazer_expect_wSymArg(UNITY_LINE_TYPE cmockLine, RKH_TE_ID_T trcEvt, rui8_t nArgs,...)
Identifies the trace event to expect with one or more arguments.
void unitrazer_cleanup(void)
Return the system under test to its initial state after the test.
void unitrazer_sm_exeAct_expect(UNITY_LINE_TYPE cmockLine, rui8_t actType, RKH_ST_T *state, void *action)
Expect for RKH_TE_SM_EXE_ACT trace event.