1 /* AUTOGENERATED FILE. DO NOT EDIT. */
2 #include <string.h>
3 #include <stdlib.h>
4 #include <setjmp.h>
5 #include "cmock.h"
6 #include "Mockmod_thermal_mgmt_extra.h"
7 
8 static const char* CMockString_data = "data";
9 static const char* CMockString_distribute_power = "distribute_power";
10 static const char* CMockString_driver_id = "driver_id";
11 static const char* CMockString_id = "id";
12 static const char* CMockString_mod_sensor_get_data = "mod_sensor_get_data";
13 static const char* CMockString_mod_thermal_mgmt_protection_api_critical = "mod_thermal_mgmt_protection_api_critical";
14 static const char* CMockString_mod_thermal_mgmt_protection_api_warning = "mod_thermal_mgmt_protection_api_warning";
15 static const char* CMockString_perf_limit = "perf_limit";
16 static const char* CMockString_perf_request = "perf_request";
17 static const char* CMockString_thermal_id = "thermal_id";
18 
19 typedef struct _CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE
20 {
21   UNITY_LINE_TYPE LineNumber;
22   char ExpectAnyArgsBool;
23   fwk_id_t Expected_driver_id;
24   fwk_id_t Expected_thermal_id;
25 
26 } CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE;
27 
28 typedef struct _CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE
29 {
30   UNITY_LINE_TYPE LineNumber;
31   char ExpectAnyArgsBool;
32   fwk_id_t Expected_driver_id;
33   fwk_id_t Expected_thermal_id;
34 
35 } CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE;
36 
37 typedef struct _CMOCK_mod_sensor_get_data_CALL_INSTANCE
38 {
39   UNITY_LINE_TYPE LineNumber;
40   char ExpectAnyArgsBool;
41   int ReturnVal;
42   fwk_id_t Expected_id;
43   struct mod_sensor_data* Expected_data;
44   int Expected_data_Depth;
45   char ReturnThruPtr_data_Used;
46   struct mod_sensor_data* ReturnThruPtr_data_Val;
47   size_t ReturnThruPtr_data_Size;
48 
49 } CMOCK_mod_sensor_get_data_CALL_INSTANCE;
50 
51 typedef struct _CMOCK_distribute_power_CALL_INSTANCE
52 {
53   UNITY_LINE_TYPE LineNumber;
54   char ExpectAnyArgsBool;
55   fwk_id_t Expected_id;
56   uint32_t* Expected_perf_request;
57   uint32_t* Expected_perf_limit;
58   int Expected_perf_request_Depth;
59   int Expected_perf_limit_Depth;
60   char ReturnThruPtr_perf_request_Used;
61   uint32_t* ReturnThruPtr_perf_request_Val;
62   size_t ReturnThruPtr_perf_request_Size;
63   char ReturnThruPtr_perf_limit_Used;
64   uint32_t* ReturnThruPtr_perf_limit_Val;
65   size_t ReturnThruPtr_perf_limit_Size;
66 
67 } CMOCK_distribute_power_CALL_INSTANCE;
68 
69 static struct Mockmod_thermal_mgmt_extraInstance
70 {
71   char mod_thermal_mgmt_protection_api_warning_CallbackBool;
72   CMOCK_mod_thermal_mgmt_protection_api_warning_CALLBACK mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer;
73   int mod_thermal_mgmt_protection_api_warning_CallbackCalls;
74   CMOCK_MEM_INDEX_TYPE mod_thermal_mgmt_protection_api_warning_CallInstance;
75   char mod_thermal_mgmt_protection_api_critical_CallbackBool;
76   CMOCK_mod_thermal_mgmt_protection_api_critical_CALLBACK mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer;
77   int mod_thermal_mgmt_protection_api_critical_CallbackCalls;
78   CMOCK_MEM_INDEX_TYPE mod_thermal_mgmt_protection_api_critical_CallInstance;
79   char mod_sensor_get_data_CallbackBool;
80   CMOCK_mod_sensor_get_data_CALLBACK mod_sensor_get_data_CallbackFunctionPointer;
81   int mod_sensor_get_data_CallbackCalls;
82   CMOCK_MEM_INDEX_TYPE mod_sensor_get_data_CallInstance;
83   char distribute_power_CallbackBool;
84   CMOCK_distribute_power_CALLBACK distribute_power_CallbackFunctionPointer;
85   int distribute_power_CallbackCalls;
86   CMOCK_MEM_INDEX_TYPE distribute_power_CallInstance;
87 } Mock;
88 
89 extern jmp_buf AbortFrame;
90 
Mockmod_thermal_mgmt_extra_Verify(void)91 void Mockmod_thermal_mgmt_extra_Verify(void)
92 {
93   UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
94   CMOCK_MEM_INDEX_TYPE call_instance;
95   call_instance = Mock.mod_thermal_mgmt_protection_api_warning_CallInstance;
96   if (CMOCK_GUTS_NONE != call_instance)
97   {
98     UNITY_SET_DETAIL(CMockString_mod_thermal_mgmt_protection_api_warning);
99     UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
100   }
101   if (Mock.mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer != NULL)
102   {
103     call_instance = CMOCK_GUTS_NONE;
104     (void)call_instance;
105   }
106   call_instance = Mock.mod_thermal_mgmt_protection_api_critical_CallInstance;
107   if (CMOCK_GUTS_NONE != call_instance)
108   {
109     UNITY_SET_DETAIL(CMockString_mod_thermal_mgmt_protection_api_critical);
110     UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
111   }
112   if (Mock.mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer != NULL)
113   {
114     call_instance = CMOCK_GUTS_NONE;
115     (void)call_instance;
116   }
117   call_instance = Mock.mod_sensor_get_data_CallInstance;
118   if (CMOCK_GUTS_NONE != call_instance)
119   {
120     UNITY_SET_DETAIL(CMockString_mod_sensor_get_data);
121     UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
122   }
123   if (Mock.mod_sensor_get_data_CallbackFunctionPointer != NULL)
124   {
125     call_instance = CMOCK_GUTS_NONE;
126     (void)call_instance;
127   }
128   call_instance = Mock.distribute_power_CallInstance;
129   if (CMOCK_GUTS_NONE != call_instance)
130   {
131     UNITY_SET_DETAIL(CMockString_distribute_power);
132     UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);
133   }
134   if (Mock.distribute_power_CallbackFunctionPointer != NULL)
135   {
136     call_instance = CMOCK_GUTS_NONE;
137     (void)call_instance;
138   }
139 }
140 
Mockmod_thermal_mgmt_extra_Init(void)141 void Mockmod_thermal_mgmt_extra_Init(void)
142 {
143   Mockmod_thermal_mgmt_extra_Destroy();
144 }
145 
Mockmod_thermal_mgmt_extra_Destroy(void)146 void Mockmod_thermal_mgmt_extra_Destroy(void)
147 {
148   CMock_Guts_MemFreeAll();
149   memset(&Mock, 0, sizeof(Mock));
150 }
151 
mod_thermal_mgmt_protection_api_warning(fwk_id_t driver_id,fwk_id_t thermal_id)152 void mod_thermal_mgmt_protection_api_warning(fwk_id_t driver_id, fwk_id_t thermal_id)
153 {
154   UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
155   CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE* cmock_call_instance;
156   UNITY_SET_DETAIL(CMockString_mod_thermal_mgmt_protection_api_warning);
157   cmock_call_instance = (CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.mod_thermal_mgmt_protection_api_warning_CallInstance);
158   Mock.mod_thermal_mgmt_protection_api_warning_CallInstance = CMock_Guts_MemNext(Mock.mod_thermal_mgmt_protection_api_warning_CallInstance);
159   if (!Mock.mod_thermal_mgmt_protection_api_warning_CallbackBool &&
160       Mock.mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer != NULL)
161   {
162     Mock.mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer(driver_id, thermal_id, Mock.mod_thermal_mgmt_protection_api_warning_CallbackCalls++);
163     UNITY_CLR_DETAILS();
164     return;
165   }
166   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
167   cmock_line = cmock_call_instance->LineNumber;
168   if (!cmock_call_instance->ExpectAnyArgsBool)
169   {
170   {
171     UNITY_SET_DETAILS(CMockString_mod_thermal_mgmt_protection_api_warning,CMockString_driver_id);
172     UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_driver_id), (void*)(&driver_id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
173   }
174   {
175     UNITY_SET_DETAILS(CMockString_mod_thermal_mgmt_protection_api_warning,CMockString_thermal_id);
176     UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_thermal_id), (void*)(&thermal_id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
177   }
178   }
179   if (Mock.mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer != NULL)
180   {
181     Mock.mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer(driver_id, thermal_id, Mock.mod_thermal_mgmt_protection_api_warning_CallbackCalls++);
182   }
183   UNITY_CLR_DETAILS();
184 }
185 
186 void CMockExpectParameters_mod_thermal_mgmt_protection_api_warning(CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE* cmock_call_instance, fwk_id_t driver_id, fwk_id_t thermal_id);
CMockExpectParameters_mod_thermal_mgmt_protection_api_warning(CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE * cmock_call_instance,fwk_id_t driver_id,fwk_id_t thermal_id)187 void CMockExpectParameters_mod_thermal_mgmt_protection_api_warning(CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE* cmock_call_instance, fwk_id_t driver_id, fwk_id_t thermal_id)
188 {
189   memcpy((void*)(&cmock_call_instance->Expected_driver_id), (void*)(&driver_id),
190          sizeof(fwk_id_t[sizeof(driver_id) == sizeof(fwk_id_t) ? 1 : -1])); /* add fwk_id_t to :treat_as_array if this causes an error */
191   memcpy((void*)(&cmock_call_instance->Expected_thermal_id), (void*)(&thermal_id),
192          sizeof(fwk_id_t[sizeof(thermal_id) == sizeof(fwk_id_t) ? 1 : -1])); /* add fwk_id_t to :treat_as_array if this causes an error */
193 }
194 
mod_thermal_mgmt_protection_api_warning_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)195 void mod_thermal_mgmt_protection_api_warning_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)
196 {
197   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE));
198   CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
199   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
200   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
201   Mock.mod_thermal_mgmt_protection_api_warning_CallInstance = CMock_Guts_MemChain(Mock.mod_thermal_mgmt_protection_api_warning_CallInstance, cmock_guts_index);
202   cmock_call_instance->LineNumber = cmock_line;
203   cmock_call_instance->ExpectAnyArgsBool = (char)0;
204   cmock_call_instance->ExpectAnyArgsBool = (char)1;
205 }
206 
mod_thermal_mgmt_protection_api_warning_CMockExpect(UNITY_LINE_TYPE cmock_line,fwk_id_t driver_id,fwk_id_t thermal_id)207 void mod_thermal_mgmt_protection_api_warning_CMockExpect(UNITY_LINE_TYPE cmock_line, fwk_id_t driver_id, fwk_id_t thermal_id)
208 {
209   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE));
210   CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_thermal_mgmt_protection_api_warning_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
211   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
212   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
213   Mock.mod_thermal_mgmt_protection_api_warning_CallInstance = CMock_Guts_MemChain(Mock.mod_thermal_mgmt_protection_api_warning_CallInstance, cmock_guts_index);
214   cmock_call_instance->LineNumber = cmock_line;
215   cmock_call_instance->ExpectAnyArgsBool = (char)0;
216   CMockExpectParameters_mod_thermal_mgmt_protection_api_warning(cmock_call_instance, driver_id, thermal_id);
217 }
218 
mod_thermal_mgmt_protection_api_warning_AddCallback(CMOCK_mod_thermal_mgmt_protection_api_warning_CALLBACK Callback)219 void mod_thermal_mgmt_protection_api_warning_AddCallback(CMOCK_mod_thermal_mgmt_protection_api_warning_CALLBACK Callback)
220 {
221   Mock.mod_thermal_mgmt_protection_api_warning_CallbackBool = (char)1;
222   Mock.mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer = Callback;
223 }
224 
mod_thermal_mgmt_protection_api_warning_Stub(CMOCK_mod_thermal_mgmt_protection_api_warning_CALLBACK Callback)225 void mod_thermal_mgmt_protection_api_warning_Stub(CMOCK_mod_thermal_mgmt_protection_api_warning_CALLBACK Callback)
226 {
227   Mock.mod_thermal_mgmt_protection_api_warning_CallbackBool = (char)0;
228   Mock.mod_thermal_mgmt_protection_api_warning_CallbackFunctionPointer = Callback;
229 }
230 
mod_thermal_mgmt_protection_api_critical(fwk_id_t driver_id,fwk_id_t thermal_id)231 void mod_thermal_mgmt_protection_api_critical(fwk_id_t driver_id, fwk_id_t thermal_id)
232 {
233   UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
234   CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE* cmock_call_instance;
235   UNITY_SET_DETAIL(CMockString_mod_thermal_mgmt_protection_api_critical);
236   cmock_call_instance = (CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.mod_thermal_mgmt_protection_api_critical_CallInstance);
237   Mock.mod_thermal_mgmt_protection_api_critical_CallInstance = CMock_Guts_MemNext(Mock.mod_thermal_mgmt_protection_api_critical_CallInstance);
238   if (!Mock.mod_thermal_mgmt_protection_api_critical_CallbackBool &&
239       Mock.mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer != NULL)
240   {
241     Mock.mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer(driver_id, thermal_id, Mock.mod_thermal_mgmt_protection_api_critical_CallbackCalls++);
242     UNITY_CLR_DETAILS();
243     return;
244   }
245   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
246   cmock_line = cmock_call_instance->LineNumber;
247   if (!cmock_call_instance->ExpectAnyArgsBool)
248   {
249   {
250     UNITY_SET_DETAILS(CMockString_mod_thermal_mgmt_protection_api_critical,CMockString_driver_id);
251     UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_driver_id), (void*)(&driver_id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
252   }
253   {
254     UNITY_SET_DETAILS(CMockString_mod_thermal_mgmt_protection_api_critical,CMockString_thermal_id);
255     UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_thermal_id), (void*)(&thermal_id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
256   }
257   }
258   if (Mock.mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer != NULL)
259   {
260     Mock.mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer(driver_id, thermal_id, Mock.mod_thermal_mgmt_protection_api_critical_CallbackCalls++);
261   }
262   UNITY_CLR_DETAILS();
263 }
264 
265 void CMockExpectParameters_mod_thermal_mgmt_protection_api_critical(CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE* cmock_call_instance, fwk_id_t driver_id, fwk_id_t thermal_id);
CMockExpectParameters_mod_thermal_mgmt_protection_api_critical(CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE * cmock_call_instance,fwk_id_t driver_id,fwk_id_t thermal_id)266 void CMockExpectParameters_mod_thermal_mgmt_protection_api_critical(CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE* cmock_call_instance, fwk_id_t driver_id, fwk_id_t thermal_id)
267 {
268   memcpy((void*)(&cmock_call_instance->Expected_driver_id), (void*)(&driver_id),
269          sizeof(fwk_id_t[sizeof(driver_id) == sizeof(fwk_id_t) ? 1 : -1])); /* add fwk_id_t to :treat_as_array if this causes an error */
270   memcpy((void*)(&cmock_call_instance->Expected_thermal_id), (void*)(&thermal_id),
271          sizeof(fwk_id_t[sizeof(thermal_id) == sizeof(fwk_id_t) ? 1 : -1])); /* add fwk_id_t to :treat_as_array if this causes an error */
272 }
273 
mod_thermal_mgmt_protection_api_critical_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)274 void mod_thermal_mgmt_protection_api_critical_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)
275 {
276   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE));
277   CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
278   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
279   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
280   Mock.mod_thermal_mgmt_protection_api_critical_CallInstance = CMock_Guts_MemChain(Mock.mod_thermal_mgmt_protection_api_critical_CallInstance, cmock_guts_index);
281   cmock_call_instance->LineNumber = cmock_line;
282   cmock_call_instance->ExpectAnyArgsBool = (char)0;
283   cmock_call_instance->ExpectAnyArgsBool = (char)1;
284 }
285 
mod_thermal_mgmt_protection_api_critical_CMockExpect(UNITY_LINE_TYPE cmock_line,fwk_id_t driver_id,fwk_id_t thermal_id)286 void mod_thermal_mgmt_protection_api_critical_CMockExpect(UNITY_LINE_TYPE cmock_line, fwk_id_t driver_id, fwk_id_t thermal_id)
287 {
288   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE));
289   CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_thermal_mgmt_protection_api_critical_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
290   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
291   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
292   Mock.mod_thermal_mgmt_protection_api_critical_CallInstance = CMock_Guts_MemChain(Mock.mod_thermal_mgmt_protection_api_critical_CallInstance, cmock_guts_index);
293   cmock_call_instance->LineNumber = cmock_line;
294   cmock_call_instance->ExpectAnyArgsBool = (char)0;
295   CMockExpectParameters_mod_thermal_mgmt_protection_api_critical(cmock_call_instance, driver_id, thermal_id);
296 }
297 
mod_thermal_mgmt_protection_api_critical_AddCallback(CMOCK_mod_thermal_mgmt_protection_api_critical_CALLBACK Callback)298 void mod_thermal_mgmt_protection_api_critical_AddCallback(CMOCK_mod_thermal_mgmt_protection_api_critical_CALLBACK Callback)
299 {
300   Mock.mod_thermal_mgmt_protection_api_critical_CallbackBool = (char)1;
301   Mock.mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer = Callback;
302 }
303 
mod_thermal_mgmt_protection_api_critical_Stub(CMOCK_mod_thermal_mgmt_protection_api_critical_CALLBACK Callback)304 void mod_thermal_mgmt_protection_api_critical_Stub(CMOCK_mod_thermal_mgmt_protection_api_critical_CALLBACK Callback)
305 {
306   Mock.mod_thermal_mgmt_protection_api_critical_CallbackBool = (char)0;
307   Mock.mod_thermal_mgmt_protection_api_critical_CallbackFunctionPointer = Callback;
308 }
309 
mod_sensor_get_data(fwk_id_t id,struct mod_sensor_data * data)310 int mod_sensor_get_data(fwk_id_t id, struct mod_sensor_data* data)
311 {
312   UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
313   CMOCK_mod_sensor_get_data_CALL_INSTANCE* cmock_call_instance;
314   UNITY_SET_DETAIL(CMockString_mod_sensor_get_data);
315   cmock_call_instance = (CMOCK_mod_sensor_get_data_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.mod_sensor_get_data_CallInstance);
316   Mock.mod_sensor_get_data_CallInstance = CMock_Guts_MemNext(Mock.mod_sensor_get_data_CallInstance);
317   if (!Mock.mod_sensor_get_data_CallbackBool &&
318       Mock.mod_sensor_get_data_CallbackFunctionPointer != NULL)
319   {
320     int cmock_cb_ret = Mock.mod_sensor_get_data_CallbackFunctionPointer(id, data, Mock.mod_sensor_get_data_CallbackCalls++);
321     UNITY_CLR_DETAILS();
322     return cmock_cb_ret;
323   }
324   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
325   cmock_line = cmock_call_instance->LineNumber;
326   if (!cmock_call_instance->ExpectAnyArgsBool)
327   {
328   {
329     UNITY_SET_DETAILS(CMockString_mod_sensor_get_data,CMockString_id);
330     UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_id), (void*)(&id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
331   }
332   {
333     UNITY_SET_DETAILS(CMockString_mod_sensor_get_data,CMockString_data);
334     if (cmock_call_instance->Expected_data == NULL)
335       { UNITY_TEST_ASSERT_NULL(data, cmock_line, CMockStringExpNULL); }
336     else
337       { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(cmock_call_instance->Expected_data), (void*)(data), sizeof(struct mod_sensor_data), cmock_call_instance->Expected_data_Depth, cmock_line, CMockStringMismatch); }
338   }
339   }
340   if (Mock.mod_sensor_get_data_CallbackFunctionPointer != NULL)
341   {
342     cmock_call_instance->ReturnVal = Mock.mod_sensor_get_data_CallbackFunctionPointer(id, data, Mock.mod_sensor_get_data_CallbackCalls++);
343   }
344   if (cmock_call_instance->ReturnThruPtr_data_Used)
345   {
346     UNITY_TEST_ASSERT_NOT_NULL(data, cmock_line, CMockStringPtrIsNULL);
347     memcpy((void*)data, (void*)cmock_call_instance->ReturnThruPtr_data_Val,
348       cmock_call_instance->ReturnThruPtr_data_Size);
349   }
350   UNITY_CLR_DETAILS();
351   return cmock_call_instance->ReturnVal;
352 }
353 
354 void CMockExpectParameters_mod_sensor_get_data(CMOCK_mod_sensor_get_data_CALL_INSTANCE* cmock_call_instance, fwk_id_t id, struct mod_sensor_data* data, int data_Depth);
CMockExpectParameters_mod_sensor_get_data(CMOCK_mod_sensor_get_data_CALL_INSTANCE * cmock_call_instance,fwk_id_t id,struct mod_sensor_data * data,int data_Depth)355 void CMockExpectParameters_mod_sensor_get_data(CMOCK_mod_sensor_get_data_CALL_INSTANCE* cmock_call_instance, fwk_id_t id, struct mod_sensor_data* data, int data_Depth)
356 {
357   memcpy((void*)(&cmock_call_instance->Expected_id), (void*)(&id),
358          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 */
359   cmock_call_instance->Expected_data = data;
360   cmock_call_instance->Expected_data_Depth = data_Depth;
361   cmock_call_instance->ReturnThruPtr_data_Used = 0;
362 }
363 
mod_sensor_get_data_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line,int cmock_to_return)364 void mod_sensor_get_data_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)
365 {
366   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_mod_sensor_get_data_CALL_INSTANCE));
367   CMOCK_mod_sensor_get_data_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_sensor_get_data_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
368   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
369   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
370   Mock.mod_sensor_get_data_CallInstance = CMock_Guts_MemChain(Mock.mod_sensor_get_data_CallInstance, cmock_guts_index);
371   cmock_call_instance->LineNumber = cmock_line;
372   cmock_call_instance->ExpectAnyArgsBool = (char)0;
373   cmock_call_instance->ReturnVal = cmock_to_return;
374   cmock_call_instance->ExpectAnyArgsBool = (char)1;
375 }
376 
mod_sensor_get_data_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line,fwk_id_t id,struct mod_sensor_data * data,int cmock_to_return)377 void mod_sensor_get_data_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, fwk_id_t id, struct mod_sensor_data* data, int cmock_to_return)
378 {
379   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_mod_sensor_get_data_CALL_INSTANCE));
380   CMOCK_mod_sensor_get_data_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_sensor_get_data_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
381   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
382   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
383   Mock.mod_sensor_get_data_CallInstance = CMock_Guts_MemChain(Mock.mod_sensor_get_data_CallInstance, cmock_guts_index);
384   cmock_call_instance->LineNumber = cmock_line;
385   cmock_call_instance->ExpectAnyArgsBool = (char)0;
386   CMockExpectParameters_mod_sensor_get_data(cmock_call_instance, id, data, 1);
387   cmock_call_instance->ReturnVal = cmock_to_return;
388 }
389 
mod_sensor_get_data_AddCallback(CMOCK_mod_sensor_get_data_CALLBACK Callback)390 void mod_sensor_get_data_AddCallback(CMOCK_mod_sensor_get_data_CALLBACK Callback)
391 {
392   Mock.mod_sensor_get_data_CallbackBool = (char)1;
393   Mock.mod_sensor_get_data_CallbackFunctionPointer = Callback;
394 }
395 
mod_sensor_get_data_Stub(CMOCK_mod_sensor_get_data_CALLBACK Callback)396 void mod_sensor_get_data_Stub(CMOCK_mod_sensor_get_data_CALLBACK Callback)
397 {
398   Mock.mod_sensor_get_data_CallbackBool = (char)0;
399   Mock.mod_sensor_get_data_CallbackFunctionPointer = Callback;
400 }
401 
mod_sensor_get_data_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line,fwk_id_t id,struct mod_sensor_data * data,int data_Depth,int cmock_to_return)402 void mod_sensor_get_data_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, fwk_id_t id, struct mod_sensor_data* data, int data_Depth, int cmock_to_return)
403 {
404   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_mod_sensor_get_data_CALL_INSTANCE));
405   CMOCK_mod_sensor_get_data_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_sensor_get_data_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
406   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
407   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
408   Mock.mod_sensor_get_data_CallInstance = CMock_Guts_MemChain(Mock.mod_sensor_get_data_CallInstance, cmock_guts_index);
409   cmock_call_instance->LineNumber = cmock_line;
410   cmock_call_instance->ExpectAnyArgsBool = (char)0;
411   CMockExpectParameters_mod_sensor_get_data(cmock_call_instance, id, data, data_Depth);
412   cmock_call_instance->ReturnVal = cmock_to_return;
413 }
414 
mod_sensor_get_data_CMockReturnMemThruPtr_data(UNITY_LINE_TYPE cmock_line,struct mod_sensor_data * data,size_t cmock_size)415 void mod_sensor_get_data_CMockReturnMemThruPtr_data(UNITY_LINE_TYPE cmock_line, struct mod_sensor_data* data, size_t cmock_size)
416 {
417   CMOCK_mod_sensor_get_data_CALL_INSTANCE* cmock_call_instance = (CMOCK_mod_sensor_get_data_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.mod_sensor_get_data_CallInstance));
418   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringPtrPreExp);
419   cmock_call_instance->ReturnThruPtr_data_Used = 1;
420   cmock_call_instance->ReturnThruPtr_data_Val = data;
421   cmock_call_instance->ReturnThruPtr_data_Size = cmock_size;
422 }
423 
distribute_power(fwk_id_t id,uint32_t * perf_request,uint32_t * perf_limit)424 void distribute_power(fwk_id_t id, uint32_t* perf_request, uint32_t* perf_limit)
425 {
426   UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;
427   CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance;
428   UNITY_SET_DETAIL(CMockString_distribute_power);
429   cmock_call_instance = (CMOCK_distribute_power_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.distribute_power_CallInstance);
430   Mock.distribute_power_CallInstance = CMock_Guts_MemNext(Mock.distribute_power_CallInstance);
431   if (!Mock.distribute_power_CallbackBool &&
432       Mock.distribute_power_CallbackFunctionPointer != NULL)
433   {
434     Mock.distribute_power_CallbackFunctionPointer(id, perf_request, perf_limit, Mock.distribute_power_CallbackCalls++);
435     UNITY_CLR_DETAILS();
436     return;
437   }
438   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringCalledMore);
439   cmock_line = cmock_call_instance->LineNumber;
440   if (!cmock_call_instance->ExpectAnyArgsBool)
441   {
442   {
443     UNITY_SET_DETAILS(CMockString_distribute_power,CMockString_id);
444     UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(&cmock_call_instance->Expected_id), (void*)(&id), sizeof(fwk_id_t), cmock_line, CMockStringMismatch);
445   }
446   {
447     UNITY_SET_DETAILS(CMockString_distribute_power,CMockString_perf_request);
448     if (cmock_call_instance->Expected_perf_request == NULL)
449       { UNITY_TEST_ASSERT_NULL(perf_request, cmock_line, CMockStringExpNULL); }
450     else
451       { UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(cmock_call_instance->Expected_perf_request, perf_request, cmock_call_instance->Expected_perf_request_Depth, cmock_line, CMockStringMismatch); }
452   }
453   {
454     UNITY_SET_DETAILS(CMockString_distribute_power,CMockString_perf_limit);
455     if (cmock_call_instance->Expected_perf_limit == NULL)
456       { UNITY_TEST_ASSERT_NULL(perf_limit, cmock_line, CMockStringExpNULL); }
457     else
458       { UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(cmock_call_instance->Expected_perf_limit, perf_limit, cmock_call_instance->Expected_perf_limit_Depth, cmock_line, CMockStringMismatch); }
459   }
460   }
461   if (Mock.distribute_power_CallbackFunctionPointer != NULL)
462   {
463     Mock.distribute_power_CallbackFunctionPointer(id, perf_request, perf_limit, Mock.distribute_power_CallbackCalls++);
464   }
465   if (cmock_call_instance->ReturnThruPtr_perf_request_Used)
466   {
467     UNITY_TEST_ASSERT_NOT_NULL(perf_request, cmock_line, CMockStringPtrIsNULL);
468     memcpy((void*)perf_request, (void*)cmock_call_instance->ReturnThruPtr_perf_request_Val,
469       cmock_call_instance->ReturnThruPtr_perf_request_Size);
470   }
471   if (cmock_call_instance->ReturnThruPtr_perf_limit_Used)
472   {
473     UNITY_TEST_ASSERT_NOT_NULL(perf_limit, cmock_line, CMockStringPtrIsNULL);
474     memcpy((void*)perf_limit, (void*)cmock_call_instance->ReturnThruPtr_perf_limit_Val,
475       cmock_call_instance->ReturnThruPtr_perf_limit_Size);
476   }
477   UNITY_CLR_DETAILS();
478 }
479 
480 void CMockExpectParameters_distribute_power(CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance, fwk_id_t id, uint32_t* perf_request, int perf_request_Depth, uint32_t* perf_limit, int perf_limit_Depth);
CMockExpectParameters_distribute_power(CMOCK_distribute_power_CALL_INSTANCE * cmock_call_instance,fwk_id_t id,uint32_t * perf_request,int perf_request_Depth,uint32_t * perf_limit,int perf_limit_Depth)481 void CMockExpectParameters_distribute_power(CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance, fwk_id_t id, uint32_t* perf_request, int perf_request_Depth, uint32_t* perf_limit, int perf_limit_Depth)
482 {
483   memcpy((void*)(&cmock_call_instance->Expected_id), (void*)(&id),
484          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 */
485   cmock_call_instance->Expected_perf_request = perf_request;
486   cmock_call_instance->Expected_perf_request_Depth = perf_request_Depth;
487   cmock_call_instance->ReturnThruPtr_perf_request_Used = 0;
488   cmock_call_instance->Expected_perf_limit = perf_limit;
489   cmock_call_instance->Expected_perf_limit_Depth = perf_limit_Depth;
490   cmock_call_instance->ReturnThruPtr_perf_limit_Used = 0;
491 }
492 
distribute_power_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)493 void distribute_power_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)
494 {
495   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_distribute_power_CALL_INSTANCE));
496   CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance = (CMOCK_distribute_power_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
497   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
498   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
499   Mock.distribute_power_CallInstance = CMock_Guts_MemChain(Mock.distribute_power_CallInstance, cmock_guts_index);
500   cmock_call_instance->LineNumber = cmock_line;
501   cmock_call_instance->ExpectAnyArgsBool = (char)0;
502   cmock_call_instance->ExpectAnyArgsBool = (char)1;
503 }
504 
distribute_power_CMockExpect(UNITY_LINE_TYPE cmock_line,fwk_id_t id,uint32_t * perf_request,uint32_t * perf_limit)505 void distribute_power_CMockExpect(UNITY_LINE_TYPE cmock_line, fwk_id_t id, uint32_t* perf_request, uint32_t* perf_limit)
506 {
507   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_distribute_power_CALL_INSTANCE));
508   CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance = (CMOCK_distribute_power_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.distribute_power_CallInstance = CMock_Guts_MemChain(Mock.distribute_power_CallInstance, cmock_guts_index);
512   cmock_call_instance->LineNumber = cmock_line;
513   cmock_call_instance->ExpectAnyArgsBool = (char)0;
514   CMockExpectParameters_distribute_power(cmock_call_instance, id, perf_request, 1, perf_limit, 1);
515 }
516 
distribute_power_AddCallback(CMOCK_distribute_power_CALLBACK Callback)517 void distribute_power_AddCallback(CMOCK_distribute_power_CALLBACK Callback)
518 {
519   Mock.distribute_power_CallbackBool = (char)1;
520   Mock.distribute_power_CallbackFunctionPointer = Callback;
521 }
522 
distribute_power_Stub(CMOCK_distribute_power_CALLBACK Callback)523 void distribute_power_Stub(CMOCK_distribute_power_CALLBACK Callback)
524 {
525   Mock.distribute_power_CallbackBool = (char)0;
526   Mock.distribute_power_CallbackFunctionPointer = Callback;
527 }
528 
distribute_power_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line,fwk_id_t id,uint32_t * perf_request,int perf_request_Depth,uint32_t * perf_limit,int perf_limit_Depth)529 void distribute_power_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, fwk_id_t id, uint32_t* perf_request, int perf_request_Depth, uint32_t* perf_limit, int perf_limit_Depth)
530 {
531   CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_distribute_power_CALL_INSTANCE));
532   CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance = (CMOCK_distribute_power_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
533   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
534   memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
535   Mock.distribute_power_CallInstance = CMock_Guts_MemChain(Mock.distribute_power_CallInstance, cmock_guts_index);
536   cmock_call_instance->LineNumber = cmock_line;
537   cmock_call_instance->ExpectAnyArgsBool = (char)0;
538   CMockExpectParameters_distribute_power(cmock_call_instance, id, perf_request, perf_request_Depth, perf_limit, perf_limit_Depth);
539 }
540 
distribute_power_CMockReturnMemThruPtr_perf_request(UNITY_LINE_TYPE cmock_line,uint32_t * perf_request,size_t cmock_size)541 void distribute_power_CMockReturnMemThruPtr_perf_request(UNITY_LINE_TYPE cmock_line, uint32_t* perf_request, size_t cmock_size)
542 {
543   CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance = (CMOCK_distribute_power_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.distribute_power_CallInstance));
544   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringPtrPreExp);
545   cmock_call_instance->ReturnThruPtr_perf_request_Used = 1;
546   cmock_call_instance->ReturnThruPtr_perf_request_Val = perf_request;
547   cmock_call_instance->ReturnThruPtr_perf_request_Size = cmock_size;
548 }
549 
distribute_power_CMockReturnMemThruPtr_perf_limit(UNITY_LINE_TYPE cmock_line,uint32_t * perf_limit,size_t cmock_size)550 void distribute_power_CMockReturnMemThruPtr_perf_limit(UNITY_LINE_TYPE cmock_line, uint32_t* perf_limit, size_t cmock_size)
551 {
552   CMOCK_distribute_power_CALL_INSTANCE* cmock_call_instance = (CMOCK_distribute_power_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.distribute_power_CallInstance));
553   UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringPtrPreExp);
554   cmock_call_instance->ReturnThruPtr_perf_limit_Used = 1;
555   cmock_call_instance->ReturnThruPtr_perf_limit_Val = perf_limit;
556   cmock_call_instance->ReturnThruPtr_perf_limit_Size = cmock_size;
557 }
558 
559