1 /* AUTOGENERATED FILE. DO NOT EDIT. */
2 #include <string.h>
3 #include <stdlib.h>
4 #include <setjmp.h>
5 #include "cmock.h"
6 #include "internal/Mockfwk_module_internal.h"
7
8 static const char* CMockString_element_id = "element_id";
9 static const char* CMockString_fwk_module_get_ctx = "fwk_module_get_ctx";
10 static const char* CMockString_fwk_module_get_element_ctx = "fwk_module_get_element_ctx";
11 static const char* CMockString_fwk_module_get_state = "fwk_module_get_state";
12 static const char* CMockString_fwk_module_reset = "fwk_module_reset";
13 static const char* CMockString_fwk_module_start = "fwk_module_start";
14 static const char* CMockString_fwk_module_stop = "fwk_module_stop";
15 static const char* CMockString_id = "id";
16 static const char* CMockString_state = "state";
17
18 typedef struct _CMOCK_fwk_module_start_CALL_INSTANCE
19 {
20 UNITY_LINE_TYPE LineNumber;
21 char ExpectAnyArgsBool;
22 int ReturnVal;
23
24 } CMOCK_fwk_module_start_CALL_INSTANCE;
25
26 typedef struct _CMOCK_fwk_module_stop_CALL_INSTANCE
27 {
28 UNITY_LINE_TYPE LineNumber;
29 char ExpectAnyArgsBool;
30 int ReturnVal;
31
32 } CMOCK_fwk_module_stop_CALL_INSTANCE;
33
34 typedef struct _CMOCK_fwk_module_get_ctx_CALL_INSTANCE
35 {
36 UNITY_LINE_TYPE LineNumber;
37 char ExpectAnyArgsBool;
38 struct fwk_module_context* ReturnVal;
39 fwk_id_t Expected_id;
40
41 } CMOCK_fwk_module_get_ctx_CALL_INSTANCE;
42
43 typedef struct _CMOCK_fwk_module_get_state_CALL_INSTANCE
44 {
45 UNITY_LINE_TYPE LineNumber;
46 char ExpectAnyArgsBool;
47 int ReturnVal;
48 fwk_id_t Expected_id;
49 enum fwk_module_state* Expected_state;
50 char ReturnThruPtr_state_Used;
51 enum fwk_module_state* ReturnThruPtr_state_Val;
52 size_t ReturnThruPtr_state_Size;
53
54 } CMOCK_fwk_module_get_state_CALL_INSTANCE;
55
56 typedef struct _CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE
57 {
58 UNITY_LINE_TYPE LineNumber;
59 char ExpectAnyArgsBool;
60 struct fwk_element_ctx* ReturnVal;
61 fwk_id_t Expected_element_id;
62
63 } CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE;
64
65 typedef struct _CMOCK_fwk_module_reset_CALL_INSTANCE
66 {
67 UNITY_LINE_TYPE LineNumber;
68 char ExpectAnyArgsBool;
69
70 } CMOCK_fwk_module_reset_CALL_INSTANCE;
71
72 static struct Mockfwk_module_internalInstance
73 {
74 char fwk_module_start_CallbackBool;
75 CMOCK_fwk_module_start_CALLBACK fwk_module_start_CallbackFunctionPointer;
76 int fwk_module_start_CallbackCalls;
77 CMOCK_MEM_INDEX_TYPE fwk_module_start_CallInstance;
78 char fwk_module_stop_CallbackBool;
79 CMOCK_fwk_module_stop_CALLBACK fwk_module_stop_CallbackFunctionPointer;
80 int fwk_module_stop_CallbackCalls;
81 CMOCK_MEM_INDEX_TYPE fwk_module_stop_CallInstance;
82 char fwk_module_get_ctx_CallbackBool;
83 CMOCK_fwk_module_get_ctx_CALLBACK fwk_module_get_ctx_CallbackFunctionPointer;
84 int fwk_module_get_ctx_CallbackCalls;
85 CMOCK_MEM_INDEX_TYPE fwk_module_get_ctx_CallInstance;
86 char fwk_module_get_state_CallbackBool;
87 CMOCK_fwk_module_get_state_CALLBACK fwk_module_get_state_CallbackFunctionPointer;
88 int fwk_module_get_state_CallbackCalls;
89 CMOCK_MEM_INDEX_TYPE fwk_module_get_state_CallInstance;
90 char fwk_module_get_element_ctx_CallbackBool;
91 CMOCK_fwk_module_get_element_ctx_CALLBACK fwk_module_get_element_ctx_CallbackFunctionPointer;
92 int fwk_module_get_element_ctx_CallbackCalls;
93 CMOCK_MEM_INDEX_TYPE fwk_module_get_element_ctx_CallInstance;
94 char fwk_module_reset_CallbackBool;
95 CMOCK_fwk_module_reset_CALLBACK fwk_module_reset_CallbackFunctionPointer;
96 int fwk_module_reset_CallbackCalls;
97 CMOCK_MEM_INDEX_TYPE fwk_module_reset_CallInstance;
98 } Mock;
99
100 extern jmp_buf AbortFrame;
101
Mockfwk_module_internal_Verify(void)102 void Mockfwk_module_internal_Verify(void)
103 {
104 UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
105 CMOCK_MEM_INDEX_TYPE call_instance;
106 call_instance = Mock.fwk_module_start_CallInstance;
107 if (CMOCK_GUTS_NONE != call_instance)
108 {
109 UNITY_SET_DETAIL(CMockString_fwk_module_start);
110 UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
111 }
112 if (Mock.fwk_module_start_CallbackFunctionPointer != NULL)
113 {
114 call_instance = CMOCK_GUTS_NONE;
115 (void)call_instance;
116 }
117 call_instance = Mock.fwk_module_stop_CallInstance;
118 if (CMOCK_GUTS_NONE != call_instance)
119 {
120 UNITY_SET_DETAIL(CMockString_fwk_module_stop);
121 UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
122 }
123 if (Mock.fwk_module_stop_CallbackFunctionPointer != NULL)
124 {
125 call_instance = CMOCK_GUTS_NONE;
126 (void)call_instance;
127 }
128 call_instance = Mock.fwk_module_get_ctx_CallInstance;
129 if (CMOCK_GUTS_NONE != call_instance)
130 {
131 UNITY_SET_DETAIL(CMockString_fwk_module_get_ctx);
132 UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
133 }
134 if (Mock.fwk_module_get_ctx_CallbackFunctionPointer != NULL)
135 {
136 call_instance = CMOCK_GUTS_NONE;
137 (void)call_instance;
138 }
139 call_instance = Mock.fwk_module_get_state_CallInstance;
140 if (CMOCK_GUTS_NONE != call_instance)
141 {
142 UNITY_SET_DETAIL(CMockString_fwk_module_get_state);
143 UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
144 }
145 if (Mock.fwk_module_get_state_CallbackFunctionPointer != NULL)
146 {
147 call_instance = CMOCK_GUTS_NONE;
148 (void)call_instance;
149 }
150 call_instance = Mock.fwk_module_get_element_ctx_CallInstance;
151 if (CMOCK_GUTS_NONE != call_instance)
152 {
153 UNITY_SET_DETAIL(CMockString_fwk_module_get_element_ctx);
154 UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
155 }
156 if (Mock.fwk_module_get_element_ctx_CallbackFunctionPointer != NULL)
157 {
158 call_instance = CMOCK_GUTS_NONE;
159 (void)call_instance;
160 }
161 call_instance = Mock.fwk_module_reset_CallInstance;
162 if (CMOCK_GUTS_NONE != call_instance)
163 {
164 UNITY_SET_DETAIL(CMockString_fwk_module_reset);
165 UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
166 }
167 if (Mock.fwk_module_reset_CallbackFunctionPointer != NULL)
168 {
169 call_instance = CMOCK_GUTS_NONE;
170 (void)call_instance;
171 }
172 }
173
Mockfwk_module_internal_Init(void)174 void Mockfwk_module_internal_Init(void)
175 {
176 Mockfwk_module_internal_Destroy();
177 }
178
Mockfwk_module_internal_Destroy(void)179 void Mockfwk_module_internal_Destroy(void)
180 {
181 CMock_Guts_MemFreeAll();
182 memset(&Mock, 0, sizeof(Mock));
183 }
184
fwk_module_start(void)185 int fwk_module_start(void)
186 {
187 UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
188 CMOCK_fwk_module_start_CALL_INSTANCE* cmock_call_instance;
189 UNITY_SET_DETAIL(CMockString_fwk_module_start);
190 cmock_call_instance = (CMOCK_fwk_module_start_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.fwk_module_start_CallInstance);
191 Mock.fwk_module_start_CallInstance = CMock_Guts_MemNext(Mock.fwk_module_start_CallInstance);
192 if (!Mock.fwk_module_start_CallbackBool &&
193 Mock.fwk_module_start_CallbackFunctionPointer != NULL)
194 {
195 int cmock_cb_ret = Mock.fwk_module_start_CallbackFunctionPointer(Mock.fwk_module_start_CallbackCalls++);
196 UNITY_CLR_DETAILS();
197 return cmock_cb_ret;
198 }
199 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
200 cmock_line = cmock_call_instance->LineNumber;
201 if (Mock.fwk_module_start_CallbackFunctionPointer != NULL)
202 {
203 cmock_call_instance->ReturnVal = Mock.fwk_module_start_CallbackFunctionPointer(Mock.fwk_module_start_CallbackCalls++);
204 }
205 UNITY_CLR_DETAILS();
206 return cmock_call_instance->ReturnVal;
207 }
208
fwk_module_start_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line,int cmock_to_return)209 void fwk_module_start_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)
210 {
211 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_start_CALL_INSTANCE));
212 CMOCK_fwk_module_start_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_start_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
213 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
214 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
215 Mock.fwk_module_start_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_start_CallInstance, cmock_guts_index);
216 cmock_call_instance->LineNumber = cmock_line;
217 cmock_call_instance->ExpectAnyArgsBool = (char)0;
218 cmock_call_instance->ReturnVal = cmock_to_return;
219 }
220
fwk_module_start_AddCallback(CMOCK_fwk_module_start_CALLBACK Callback)221 void fwk_module_start_AddCallback(CMOCK_fwk_module_start_CALLBACK Callback)
222 {
223 Mock.fwk_module_start_CallbackBool = (char)1;
224 Mock.fwk_module_start_CallbackFunctionPointer = Callback;
225 }
226
fwk_module_start_Stub(CMOCK_fwk_module_start_CALLBACK Callback)227 void fwk_module_start_Stub(CMOCK_fwk_module_start_CALLBACK Callback)
228 {
229 Mock.fwk_module_start_CallbackBool = (char)0;
230 Mock.fwk_module_start_CallbackFunctionPointer = Callback;
231 }
232
fwk_module_stop(void)233 int fwk_module_stop(void)
234 {
235 UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
236 CMOCK_fwk_module_stop_CALL_INSTANCE* cmock_call_instance;
237 UNITY_SET_DETAIL(CMockString_fwk_module_stop);
238 cmock_call_instance = (CMOCK_fwk_module_stop_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.fwk_module_stop_CallInstance);
239 Mock.fwk_module_stop_CallInstance = CMock_Guts_MemNext(Mock.fwk_module_stop_CallInstance);
240 if (!Mock.fwk_module_stop_CallbackBool &&
241 Mock.fwk_module_stop_CallbackFunctionPointer != NULL)
242 {
243 int cmock_cb_ret = Mock.fwk_module_stop_CallbackFunctionPointer(Mock.fwk_module_stop_CallbackCalls++);
244 UNITY_CLR_DETAILS();
245 return cmock_cb_ret;
246 }
247 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
248 cmock_line = cmock_call_instance->LineNumber;
249 if (Mock.fwk_module_stop_CallbackFunctionPointer != NULL)
250 {
251 cmock_call_instance->ReturnVal = Mock.fwk_module_stop_CallbackFunctionPointer(Mock.fwk_module_stop_CallbackCalls++);
252 }
253 UNITY_CLR_DETAILS();
254 return cmock_call_instance->ReturnVal;
255 }
256
fwk_module_stop_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line,int cmock_to_return)257 void fwk_module_stop_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)
258 {
259 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_stop_CALL_INSTANCE));
260 CMOCK_fwk_module_stop_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_stop_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
261 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
262 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
263 Mock.fwk_module_stop_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_stop_CallInstance, cmock_guts_index);
264 cmock_call_instance->LineNumber = cmock_line;
265 cmock_call_instance->ExpectAnyArgsBool = (char)0;
266 cmock_call_instance->ReturnVal = cmock_to_return;
267 }
268
fwk_module_stop_AddCallback(CMOCK_fwk_module_stop_CALLBACK Callback)269 void fwk_module_stop_AddCallback(CMOCK_fwk_module_stop_CALLBACK Callback)
270 {
271 Mock.fwk_module_stop_CallbackBool = (char)1;
272 Mock.fwk_module_stop_CallbackFunctionPointer = Callback;
273 }
274
fwk_module_stop_Stub(CMOCK_fwk_module_stop_CALLBACK Callback)275 void fwk_module_stop_Stub(CMOCK_fwk_module_stop_CALLBACK Callback)
276 {
277 Mock.fwk_module_stop_CallbackBool = (char)0;
278 Mock.fwk_module_stop_CallbackFunctionPointer = Callback;
279 }
280
fwk_module_get_ctx(fwk_id_t id)281 struct fwk_module_context* fwk_module_get_ctx(fwk_id_t id)
282 {
283 UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
284 CMOCK_fwk_module_get_ctx_CALL_INSTANCE* cmock_call_instance;
285 UNITY_SET_DETAIL(CMockString_fwk_module_get_ctx);
286 cmock_call_instance = (CMOCK_fwk_module_get_ctx_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.fwk_module_get_ctx_CallInstance);
287 Mock.fwk_module_get_ctx_CallInstance = CMock_Guts_MemNext(Mock.fwk_module_get_ctx_CallInstance);
288 if (!Mock.fwk_module_get_ctx_CallbackBool &&
289 Mock.fwk_module_get_ctx_CallbackFunctionPointer != NULL)
290 {
291 struct fwk_module_context* cmock_cb_ret = Mock.fwk_module_get_ctx_CallbackFunctionPointer(id, Mock.fwk_module_get_ctx_CallbackCalls++);
292 UNITY_CLR_DETAILS();
293 return cmock_cb_ret;
294 }
295 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
296 cmock_line = cmock_call_instance->LineNumber;
297 if (!cmock_call_instance->ExpectAnyArgsBool)
298 {
299 {
300 UNITY_SET_DETAILS(CMockString_fwk_module_get_ctx,CMockString_id);
301 UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_id), (void*)(&id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
302 }
303 }
304 if (Mock.fwk_module_get_ctx_CallbackFunctionPointer != NULL)
305 {
306 cmock_call_instance->ReturnVal = Mock.fwk_module_get_ctx_CallbackFunctionPointer(id, Mock.fwk_module_get_ctx_CallbackCalls++);
307 }
308 UNITY_CLR_DETAILS();
309 return cmock_call_instance->ReturnVal;
310 }
311
312 void CMockExpectParameters_fwk_module_get_ctx(CMOCK_fwk_module_get_ctx_CALL_INSTANCE* cmock_call_instance, fwk_id_t id);
CMockExpectParameters_fwk_module_get_ctx(CMOCK_fwk_module_get_ctx_CALL_INSTANCE * cmock_call_instance,fwk_id_t id)313 void CMockExpectParameters_fwk_module_get_ctx(CMOCK_fwk_module_get_ctx_CALL_INSTANCE* cmock_call_instance, fwk_id_t id)
314 {
315 memcpy((void*)(&cmock_call_instance->Expected_id), (void*)(&id),
316 sizeof(fwk_id_t[sizeof(id) == sizeof(fwk_id_t) ? 1 : -1])); /* add fwk_id_t to :treat_as_array if this causes an error */
317 }
318
fwk_module_get_ctx_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line,struct fwk_module_context * cmock_to_return)319 void fwk_module_get_ctx_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, struct fwk_module_context* cmock_to_return)
320 {
321 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_get_ctx_CALL_INSTANCE));
322 CMOCK_fwk_module_get_ctx_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_get_ctx_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
323 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
324 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
325 Mock.fwk_module_get_ctx_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_get_ctx_CallInstance, cmock_guts_index);
326 cmock_call_instance->LineNumber = cmock_line;
327 cmock_call_instance->ExpectAnyArgsBool = (char)0;
328 cmock_call_instance->ReturnVal = cmock_to_return;
329 cmock_call_instance->ExpectAnyArgsBool = (char)1;
330 }
331
fwk_module_get_ctx_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line,fwk_id_t id,struct fwk_module_context * cmock_to_return)332 void fwk_module_get_ctx_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, fwk_id_t id, struct fwk_module_context* cmock_to_return)
333 {
334 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_get_ctx_CALL_INSTANCE));
335 CMOCK_fwk_module_get_ctx_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_get_ctx_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
336 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
337 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
338 Mock.fwk_module_get_ctx_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_get_ctx_CallInstance, cmock_guts_index);
339 cmock_call_instance->LineNumber = cmock_line;
340 cmock_call_instance->ExpectAnyArgsBool = (char)0;
341 CMockExpectParameters_fwk_module_get_ctx(cmock_call_instance, id);
342 cmock_call_instance->ReturnVal = cmock_to_return;
343 }
344
fwk_module_get_ctx_AddCallback(CMOCK_fwk_module_get_ctx_CALLBACK Callback)345 void fwk_module_get_ctx_AddCallback(CMOCK_fwk_module_get_ctx_CALLBACK Callback)
346 {
347 Mock.fwk_module_get_ctx_CallbackBool = (char)1;
348 Mock.fwk_module_get_ctx_CallbackFunctionPointer = Callback;
349 }
350
fwk_module_get_ctx_Stub(CMOCK_fwk_module_get_ctx_CALLBACK Callback)351 void fwk_module_get_ctx_Stub(CMOCK_fwk_module_get_ctx_CALLBACK Callback)
352 {
353 Mock.fwk_module_get_ctx_CallbackBool = (char)0;
354 Mock.fwk_module_get_ctx_CallbackFunctionPointer = Callback;
355 }
356
fwk_module_get_state(fwk_id_t id,enum fwk_module_state * state)357 int fwk_module_get_state(fwk_id_t id, enum fwk_module_state* state)
358 {
359 UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
360 CMOCK_fwk_module_get_state_CALL_INSTANCE* cmock_call_instance;
361 UNITY_SET_DETAIL(CMockString_fwk_module_get_state);
362 cmock_call_instance = (CMOCK_fwk_module_get_state_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.fwk_module_get_state_CallInstance);
363 Mock.fwk_module_get_state_CallInstance = CMock_Guts_MemNext(Mock.fwk_module_get_state_CallInstance);
364 if (!Mock.fwk_module_get_state_CallbackBool &&
365 Mock.fwk_module_get_state_CallbackFunctionPointer != NULL)
366 {
367 int cmock_cb_ret = Mock.fwk_module_get_state_CallbackFunctionPointer(id, state, Mock.fwk_module_get_state_CallbackCalls++);
368 UNITY_CLR_DETAILS();
369 return cmock_cb_ret;
370 }
371 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
372 cmock_line = cmock_call_instance->LineNumber;
373 if (!cmock_call_instance->ExpectAnyArgsBool)
374 {
375 {
376 UNITY_SET_DETAILS(CMockString_fwk_module_get_state,CMockString_id);
377 UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_id), (void*)(&id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
378 }
379 {
380 UNITY_SET_DETAILS(CMockString_fwk_module_get_state,CMockString_state);
381 UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(cmock_call_instance->Expected_state), (void*)(state), sizeof(enum fwk_module_state), cmock_line, CMockStringMismatch);
382 }
383 }
384 if (Mock.fwk_module_get_state_CallbackFunctionPointer != NULL)
385 {
386 cmock_call_instance->ReturnVal = Mock.fwk_module_get_state_CallbackFunctionPointer(id, state, Mock.fwk_module_get_state_CallbackCalls++);
387 }
388 if (cmock_call_instance->ReturnThruPtr_state_Used)
389 {
390 UNITY_TEST_ASSERT_NOT_NULL(state, cmock_line, CMockStringPtrIsNULL);
391 memcpy((void*)state, (void*)cmock_call_instance->ReturnThruPtr_state_Val,
392 cmock_call_instance->ReturnThruPtr_state_Size);
393 }
394 UNITY_CLR_DETAILS();
395 return cmock_call_instance->ReturnVal;
396 }
397
398 void CMockExpectParameters_fwk_module_get_state(CMOCK_fwk_module_get_state_CALL_INSTANCE* cmock_call_instance, fwk_id_t id, enum fwk_module_state* state);
CMockExpectParameters_fwk_module_get_state(CMOCK_fwk_module_get_state_CALL_INSTANCE * cmock_call_instance,fwk_id_t id,enum fwk_module_state * state)399 void CMockExpectParameters_fwk_module_get_state(CMOCK_fwk_module_get_state_CALL_INSTANCE* cmock_call_instance, fwk_id_t id, enum fwk_module_state* state)
400 {
401 memcpy((void*)(&cmock_call_instance->Expected_id), (void*)(&id),
402 sizeof(fwk_id_t[sizeof(id) == sizeof(fwk_id_t) ? 1 : -1])); /* add fwk_id_t to :treat_as_array if this causes an error */
403 cmock_call_instance->Expected_state = state;
404 cmock_call_instance->ReturnThruPtr_state_Used = 0;
405 }
406
fwk_module_get_state_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line,int cmock_to_return)407 void fwk_module_get_state_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)
408 {
409 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_get_state_CALL_INSTANCE));
410 CMOCK_fwk_module_get_state_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_get_state_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
411 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
412 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
413 Mock.fwk_module_get_state_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_get_state_CallInstance, cmock_guts_index);
414 cmock_call_instance->LineNumber = cmock_line;
415 cmock_call_instance->ExpectAnyArgsBool = (char)0;
416 cmock_call_instance->ReturnVal = cmock_to_return;
417 cmock_call_instance->ExpectAnyArgsBool = (char)1;
418 }
419
fwk_module_get_state_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line,fwk_id_t id,enum fwk_module_state * state,int cmock_to_return)420 void fwk_module_get_state_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, fwk_id_t id, enum fwk_module_state* state, int cmock_to_return)
421 {
422 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_get_state_CALL_INSTANCE));
423 CMOCK_fwk_module_get_state_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_get_state_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
424 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
425 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
426 Mock.fwk_module_get_state_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_get_state_CallInstance, cmock_guts_index);
427 cmock_call_instance->LineNumber = cmock_line;
428 cmock_call_instance->ExpectAnyArgsBool = (char)0;
429 CMockExpectParameters_fwk_module_get_state(cmock_call_instance, id, state);
430 cmock_call_instance->ReturnVal = cmock_to_return;
431 }
432
fwk_module_get_state_AddCallback(CMOCK_fwk_module_get_state_CALLBACK Callback)433 void fwk_module_get_state_AddCallback(CMOCK_fwk_module_get_state_CALLBACK Callback)
434 {
435 Mock.fwk_module_get_state_CallbackBool = (char)1;
436 Mock.fwk_module_get_state_CallbackFunctionPointer = Callback;
437 }
438
fwk_module_get_state_Stub(CMOCK_fwk_module_get_state_CALLBACK Callback)439 void fwk_module_get_state_Stub(CMOCK_fwk_module_get_state_CALLBACK Callback)
440 {
441 Mock.fwk_module_get_state_CallbackBool = (char)0;
442 Mock.fwk_module_get_state_CallbackFunctionPointer = Callback;
443 }
444
fwk_module_get_state_CMockReturnMemThruPtr_state(UNITY_LINE_TYPE cmock_line,enum fwk_module_state * state,size_t cmock_size)445 void fwk_module_get_state_CMockReturnMemThruPtr_state(UNITY_LINE_TYPE cmock_line, enum fwk_module_state* state, size_t cmock_size)
446 {
447 CMOCK_fwk_module_get_state_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_get_state_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.fwk_module_get_state_CallInstance));
448 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringPtrPreExp);
449 cmock_call_instance->ReturnThruPtr_state_Used = 1;
450 cmock_call_instance->ReturnThruPtr_state_Val = state;
451 cmock_call_instance->ReturnThruPtr_state_Size = cmock_size;
452 }
453
fwk_module_get_element_ctx(fwk_id_t element_id)454 struct fwk_element_ctx* fwk_module_get_element_ctx(fwk_id_t element_id)
455 {
456 UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
457 CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE* cmock_call_instance;
458 UNITY_SET_DETAIL(CMockString_fwk_module_get_element_ctx);
459 cmock_call_instance = (CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.fwk_module_get_element_ctx_CallInstance);
460 Mock.fwk_module_get_element_ctx_CallInstance = CMock_Guts_MemNext(Mock.fwk_module_get_element_ctx_CallInstance);
461 if (!Mock.fwk_module_get_element_ctx_CallbackBool &&
462 Mock.fwk_module_get_element_ctx_CallbackFunctionPointer != NULL)
463 {
464 struct fwk_element_ctx* cmock_cb_ret = Mock.fwk_module_get_element_ctx_CallbackFunctionPointer(element_id, Mock.fwk_module_get_element_ctx_CallbackCalls++);
465 UNITY_CLR_DETAILS();
466 return cmock_cb_ret;
467 }
468 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
469 cmock_line = cmock_call_instance->LineNumber;
470 if (!cmock_call_instance->ExpectAnyArgsBool)
471 {
472 {
473 UNITY_SET_DETAILS(CMockString_fwk_module_get_element_ctx,CMockString_element_id);
474 UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_element_id), (void*)(&element_id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
475 }
476 }
477 if (Mock.fwk_module_get_element_ctx_CallbackFunctionPointer != NULL)
478 {
479 cmock_call_instance->ReturnVal = Mock.fwk_module_get_element_ctx_CallbackFunctionPointer(element_id, Mock.fwk_module_get_element_ctx_CallbackCalls++);
480 }
481 UNITY_CLR_DETAILS();
482 return cmock_call_instance->ReturnVal;
483 }
484
485 void CMockExpectParameters_fwk_module_get_element_ctx(CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE* cmock_call_instance, fwk_id_t element_id);
CMockExpectParameters_fwk_module_get_element_ctx(CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE * cmock_call_instance,fwk_id_t element_id)486 void CMockExpectParameters_fwk_module_get_element_ctx(CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE* cmock_call_instance, fwk_id_t element_id)
487 {
488 memcpy((void*)(&cmock_call_instance->Expected_element_id), (void*)(&element_id),
489 sizeof(fwk_id_t[sizeof(element_id) == sizeof(fwk_id_t) ? 1 : -1])); /* add fwk_id_t to :treat_as_array if this causes an error */
490 }
491
fwk_module_get_element_ctx_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line,struct fwk_element_ctx * cmock_to_return)492 void fwk_module_get_element_ctx_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, struct fwk_element_ctx* cmock_to_return)
493 {
494 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE));
495 CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
496 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
497 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
498 Mock.fwk_module_get_element_ctx_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_get_element_ctx_CallInstance, cmock_guts_index);
499 cmock_call_instance->LineNumber = cmock_line;
500 cmock_call_instance->ExpectAnyArgsBool = (char)0;
501 cmock_call_instance->ReturnVal = cmock_to_return;
502 cmock_call_instance->ExpectAnyArgsBool = (char)1;
503 }
504
fwk_module_get_element_ctx_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line,fwk_id_t element_id,struct fwk_element_ctx * cmock_to_return)505 void fwk_module_get_element_ctx_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, fwk_id_t element_id, struct fwk_element_ctx* cmock_to_return)
506 {
507 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE));
508 CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_get_element_ctx_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
509 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
510 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
511 Mock.fwk_module_get_element_ctx_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_get_element_ctx_CallInstance, cmock_guts_index);
512 cmock_call_instance->LineNumber = cmock_line;
513 cmock_call_instance->ExpectAnyArgsBool = (char)0;
514 CMockExpectParameters_fwk_module_get_element_ctx(cmock_call_instance, element_id);
515 cmock_call_instance->ReturnVal = cmock_to_return;
516 }
517
fwk_module_get_element_ctx_AddCallback(CMOCK_fwk_module_get_element_ctx_CALLBACK Callback)518 void fwk_module_get_element_ctx_AddCallback(CMOCK_fwk_module_get_element_ctx_CALLBACK Callback)
519 {
520 Mock.fwk_module_get_element_ctx_CallbackBool = (char)1;
521 Mock.fwk_module_get_element_ctx_CallbackFunctionPointer = Callback;
522 }
523
fwk_module_get_element_ctx_Stub(CMOCK_fwk_module_get_element_ctx_CALLBACK Callback)524 void fwk_module_get_element_ctx_Stub(CMOCK_fwk_module_get_element_ctx_CALLBACK Callback)
525 {
526 Mock.fwk_module_get_element_ctx_CallbackBool = (char)0;
527 Mock.fwk_module_get_element_ctx_CallbackFunctionPointer = Callback;
528 }
529
fwk_module_reset(void)530 void fwk_module_reset(void)
531 {
532 UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
533 CMOCK_fwk_module_reset_CALL_INSTANCE* cmock_call_instance;
534 UNITY_SET_DETAIL(CMockString_fwk_module_reset);
535 cmock_call_instance = (CMOCK_fwk_module_reset_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.fwk_module_reset_CallInstance);
536 Mock.fwk_module_reset_CallInstance = CMock_Guts_MemNext(Mock.fwk_module_reset_CallInstance);
537 if (!Mock.fwk_module_reset_CallbackBool &&
538 Mock.fwk_module_reset_CallbackFunctionPointer != NULL)
539 {
540 Mock.fwk_module_reset_CallbackFunctionPointer(Mock.fwk_module_reset_CallbackCalls++);
541 UNITY_CLR_DETAILS();
542 return;
543 }
544 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
545 cmock_line = cmock_call_instance->LineNumber;
546 if (Mock.fwk_module_reset_CallbackFunctionPointer != NULL)
547 {
548 Mock.fwk_module_reset_CallbackFunctionPointer(Mock.fwk_module_reset_CallbackCalls++);
549 }
550 UNITY_CLR_DETAILS();
551 }
552
fwk_module_reset_CMockExpect(UNITY_LINE_TYPE cmock_line)553 void fwk_module_reset_CMockExpect(UNITY_LINE_TYPE cmock_line)
554 {
555 CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_fwk_module_reset_CALL_INSTANCE));
556 CMOCK_fwk_module_reset_CALL_INSTANCE* cmock_call_instance = (CMOCK_fwk_module_reset_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
557 UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
558 memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
559 Mock.fwk_module_reset_CallInstance = CMock_Guts_MemChain(Mock.fwk_module_reset_CallInstance, cmock_guts_index);
560 cmock_call_instance->LineNumber = cmock_line;
561 cmock_call_instance->ExpectAnyArgsBool = (char)0;
562 }
563
fwk_module_reset_AddCallback(CMOCK_fwk_module_reset_CALLBACK Callback)564 void fwk_module_reset_AddCallback(CMOCK_fwk_module_reset_CALLBACK Callback)
565 {
566 Mock.fwk_module_reset_CallbackBool = (char)1;
567 Mock.fwk_module_reset_CallbackFunctionPointer = Callback;
568 }
569
fwk_module_reset_Stub(CMOCK_fwk_module_reset_CALLBACK Callback)570 void fwk_module_reset_Stub(CMOCK_fwk_module_reset_CALLBACK Callback)
571 {
572 Mock.fwk_module_reset_CallbackBool = (char)0;
573 Mock.fwk_module_reset_CallbackFunctionPointer = Callback;
574 }
575
576