52 #ifndef __UNITRAZER_H__
53 #define __UNITRAZER_H__
57 #include "unity_fixture.h"
60 #ifdef __UNITRAZER_LIB__
61 #include "unitrzlib.h"
77 #define sm_init() unitrazer_start()
83 #define sm_cleanup() unitrazer_cleanup()
90 #define sm_verify() unitrazer_verify()
95 #define sm_init_expect(initState) \
96 unitrazer_sm_init_expect(__LINE__, initState)
98 #define unitrazer_sm_init_expect(line, initState) \
99 unitrazer_expect_wSymArg(line, RKH_TE_SM_INIT, 1, initState)
101 #define sm_init_expectAnyArgs() \
102 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_INIT)
105 #define sm_clrh_expect(historyState) \
106 unitrazer_sm_clrh_expect(__LINE__, historyState)
108 #define unitrazer_sm_clrh_expect(line, historyState) \
109 unitrazer_expect_wSymArg(line, RKH_TE_SM_CLRH, 1, historyState)
111 #define sm_clrh_expectAnyArgs() \
112 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_CLRH)
115 #define sm_trn_expect(sourceState, targetState) \
116 unitrazer_sm_trn_expect(__LINE__, sourceState, targetState)
118 #define unitrazer_sm_trn_expect(line, sourceState, targetState) \
119 unitrazer_expect_wSymArg(line, RKH_TE_SM_TRN, 2, sourceState, targetState)
121 #define sm_trn_expectAnyArgs() \
122 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_TRN)
125 #define sm_state_expect(nextState) \
126 unitrazer_sm_state_expect(__LINE__, nextState)
128 #define unitrazer_sm_state_expect(line, nextState) \
129 unitrazer_expect_wSymArg(line, RKH_TE_SM_STATE, 1, nextState)
131 #define sm_state_expectAnyArgs() \
132 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_STATE)
135 #define sm_enstate_expect(entryState) \
136 unitrazer_enstate_expect(__LINE__, entryState)
138 #define unitrazer_enstate_expect(line, entryState) \
139 unitrazer_expect_wSymArg(line, RKH_TE_SM_ENSTATE, 1, entryState)
141 #define sm_enstate_expectAnyArgs() \
142 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_ENSTATE)
145 #define sm_exstate_expect(exitState) \
146 unitrazer_exstate_expect(__LINE__, exitState)
148 #define unitrazer_exstate_expect(line, exitState) \
149 unitrazer_expect_wSymArg(line, RKH_TE_SM_EXSTATE, 1, exitState)
151 #define sm_exstate_expectAnyArgs() \
152 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_EXSTATE)
155 #define sm_nenex_expect(nEntry, nExit) \
156 unitrazer_sm_nenex_expect(__LINE__, nEntry, nExit)
158 #define unitrazer_sm_nenex_expect(line, nEntry, nExit) \
159 unitrazer_expect_wNumArg(line, RKH_TE_SM_NENEX, 2, nEntry, nExit)
161 #define sm_nenex_expectAnyArgs() \
162 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_NENEX)
165 #define sm_ntrnact_expect(nActions, nSegments) \
166 unitrazer_sm_ntrnact_expect(__LINE__, nActions, nSegments)
168 #define unitrazer_sm_ntrnact_expect(line, nActions, nSegments) \
169 unitrazer_expect_wNumArg(line, RKH_TE_SM_NTRNACT, 2, nActions, nSegments)
171 #define sm_ntrnact_expectAnyArgs() \
172 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_NTRNACT)
175 #define sm_tsState_expect(targetState) \
176 unitrazer_sm_tsState_expect(__LINE__, targetState)
178 #define unitrazer_sm_tsState_expect(line, targetState) \
179 unitrazer_expect_wSymArg(line, RKH_TE_SM_TS_STATE, 1, targetState)
181 #define sm_tsState_expectAnyArgs() \
182 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_TS_STATE)
185 #define sm_evtProc_expect() \
186 unitrazer_sm_evtProc_expect(__LINE__)
188 #define unitrazer_sm_evtProc_expect(line) \
189 unitrazer_expect_noArgs(line, RKH_TE_SM_EVT_PROC)
192 #define sm_evtNotFound_expect(signal) \
193 unitrazer_sm_evtNotFound_expect(__LINE__, signal)
195 #define unitrazer_sm_evtNotFound_expect(line, signal) \
196 unitrazer_expect_wSig(line, RKH_TE_SM_EVT_NFOUND, signal)
198 #define sm_evtNotFound_expectAnyArgs() \
199 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_EVT_NFOUND)
202 #define sm_grdFalse_expect() \
203 unitrazer_sm_grdFalse_expect(__LINE__)
205 #define unitrazer_sm_grdFalse_expect(line) \
206 unitrazer_expect_noArgs(line, RKH_TE_SM_GRD_FALSE)
209 #define sm_cndNotFound_expect() \
210 unitrazer_sm_cndNotFound_expect(__LINE__)
212 #define unitrazer_sm_cndNotFound_expect(line) \
213 unitrazer_expect_noArgs(line, RKH_TE_SM_CND_NFOUND)
216 #define sm_unknState_expect() \
217 unitrazer_sm_unknState_expect(__LINE__)
219 #define unitrazer_sm_unknState_expect(line) \
220 unitrazer_expect_noArgs(line, RKH_TE_SM_UNKN_STATE)
223 #define sm_exHLevel_expect() \
224 unitrazer_sm_exHLevel_expect(__LINE__)
226 #define unitrazer_sm_exHLevel_expect(line) \
227 unitrazer_expect_noArgs(line, RKH_TE_SM_EX_HLEVEL)
230 #define sm_exTSeg_expect() \
231 unitrazer_sm_exTSeg_expect(__LINE__)
233 #define unitrazer_sm_exTSeg_expect(line) \
234 unitrazer_expect_noArgs(line, RKH_TE_SM_EX_TSEG)
237 #define sm_exeAct_expect(actType, state, action) \
238 unitrazer_sm_exeAct_expect(__LINE__, actType, state, action)
240 #define sm_exeAct_expectAnyArgs() \
241 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_EXE_ACT)
244 #define sm_dch_expect(signal, state) \
245 unitrazer_sm_dch_expect(__LINE__, signal, state)
247 #define sm_dch_expectAnyArgs() \
248 unitrazer_expectAnyArgs(__LINE__, RKH_TE_SM_DCH)
253 #define sm_init_ignore() \
254 unitrazer_ignore(__LINE__, RKH_TE_SM_INIT)
257 #define sm_clrh_ignore() \
258 unitrazer_ignore(__LINE__, RKH_TE_SM_CLRH)
261 #define sm_trn_ignore() \
262 unitrazer_ignore(__LINE__, RKH_TE_SM_TRN)
264 #define sm_trn_ignoreArg_sourceState() \
265 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_TRN, UT_ARGNO_1)
267 #define sm_trn_ignoreArg_targetState() \
268 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_TRN, UT_ARGNO_2)
271 #define sm_state_ignore() \
272 unitrazer_ignore(__LINE__, RKH_TE_SM_STATE)
275 #define sm_enstate_ignore() \
276 unitrazer_ignore(__LINE__, RKH_TE_SM_ENSTATE)
279 #define sm_exstate_ignore() \
280 unitrazer_ignore(__LINE__, RKH_TE_SM_EXSTATE)
283 #define sm_nenex_ignore() \
284 unitrazer_ignore(__LINE__, RKH_TE_SM_NENEX)
286 #define sm_nenex_ignoreArg_nEntry() \
287 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NENEX, UT_ARGNO_1)
289 #define sm_nenex_ignoreArg_nExit() \
290 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NENEX, UT_ARGNO_2)
293 #define sm_ntrnact_ignore() \
294 unitrazer_ignore(__LINE__, RKH_TE_SM_NTRNACT)
296 #define sm_ntrnact_ignoreArg_nActions() \
297 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NTRNACT, UT_ARGNO_1)
299 #define sm_ntrnact_ignoreArg_nSegments() \
300 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_NTRNACT, UT_ARGNO_2)
303 #define sm_tsState_ignore() \
304 unitrazer_ignore(__LINE__, RKH_TE_SM_TS_STATE)
307 #define sm_evtProc_ignore() \
308 unitrazer_ignore(__LINE__, RKH_TE_SM_EVT_PROC)
311 #define sm_evtNotFound_ignore() \
312 unitrazer_ignore(__LINE__, RKH_TE_SM_EVT_NFOUND)
315 #define sm_grdFalse_ignore() \
316 unitrazer_ignore(__LINE__, RKH_TE_SM_GRD_FALSE)
319 #define sm_cndNotFound_ignore() \
320 unitrazer_ignore(__LINE__, RKH_TE_SM_CND_NFOUND)
323 #define sm_unknState_ignore() \
324 unitrazer_ignore(__LINE__, RKH_TE_SM_UNKN_STATE)
327 #define sm_exHLevel_ignore() \
328 unitrazer_ignore(__LINE__, RKH_TE_SM_EX_HLEVEL)
331 #define sm_exTSeg_ignore() \
332 unitrazer_ignore(__LINE__, RKH_TE_SM_EX_TSEG)
335 #define sm_exeAct_ignore() \
336 unitrazer_ignore(__LINE__, RKH_TE_SM_EXE_ACT)
338 #define sm_exeAct_ignoreArg_actType() \
339 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_EXE_ACT, UT_ARGNO_1)
341 #define sm_exeAct_ignoreArg_state() \
342 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_EXE_ACT, UT_ARGNO_2)
344 #define sm_exeAct_ignoreArg_action() \
345 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_EXE_ACT, UT_ARGNO_3)
348 #define sm_dch_ignore() \
349 unitrazer_ignore(__LINE__, RKH_TE_SM_DCH)
351 #define sm_dch_ignoreArg_signal() \
352 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_DCH, UT_ARGNO_1)
354 #define sm_dch_ignoreArg_state() \
355 unitrazer_ignoreArg(__LINE__, RKH_TE_SM_DCH, UT_ARGNO_2)
360 #define mp_ignore() \
361 unitrazer_ignoreGroup(__LINE__, RKH_TG_MP)
364 #define sma_ignore() \
365 unitrazer_ignoreGroup(__LINE__, RKH_TG_SMA)
368 #define fwk_ignore() \
369 unitrazer_ignoreGroup(__LINE__, RKH_TG_FWK)
372 #define sm_ignore() \
373 unitrazer_ignoreGroup(__LINE__, RKH_TG_SM)
377 #define UT_ARGNO_1 (rui8_t)0
378 #define UT_ARGNO_2 (rui8_t)1
379 #define UT_ARGNO_3 (rui8_t)2
380 #define UT_ARGNO_4 (rui8_t)3
381 #define UT_ARGNO_5 (rui8_t)4
382 #define UT_ARGNO_6 (rui8_t)5
384 #define UT_SIZEOF_MSG 256
389 UT_PROC_SUCCESS, UT_PROC_FAIL, UT_PROC_BUSY, UT_PROC_INIT
392 typedef struct UtrzProcessOut UtrzProcessOut;
394 struct UtrzProcessOut
397 char msg[UT_SIZEOF_MSG];
399 UNITY_LINE_TYPE line;
406 UtrzProcessOut * unitrazer_getLastOut(
void);
407 void unitrazer_resetOut(
void);
408 void unitrazer_log_start(
void);
523 rui8_t actType,
RKH_ST_T *state,
void * action);
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_expectAnyArgs(UNITY_LINE_TYPE cmockLine, rui8_t trcEvt)
Expect a specific trace event regardless its arguments.
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_cleanup(void)
Return the system under test to its initial state after the test.
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_ignore(UNITY_LINE_TYPE cmockLine, rui8_t trcEvt)
Ignore a specific trace event.
rui8_t RKH_TE_ID_T
Describes a trace event identification (ID).
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.
rui8_t RKH_TG_T
Group of events.
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, instead of ignoring all the arguments or the entire generated trace event, as the unitrazer_ignore() function supports.
void unitrazer_verify(void)
Makes sure there are no unused expectations, if there are, this function causes the test to fail...
Describes the common properties of regular states (basic, composite, and submachine).
RKH framwwork platform - independent interface.
void unitrazer_expect_noArgs(UNITY_LINE_TYPE cmockLine, RKH_TE_ID_T trcEvt)
Identifies the trace event to expect without arguments.
void unitrazer_start(void)
Establish the preconditions to the tests.
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_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.