Debian Codegraph @

test/system/test_interactions/doesnt_leave_details_behind.yml

raw symbols SCIP
1 ---
2 :cmock:
3 :enforce_strict_ordering: 1
4 :plugins:
5 - :array
6 - :cexception
7 - :ignore
8 - :callback
9 - :return_thru_ptr
10 - :ignore_arg
11 - :expect_any_args
12 :callback_after_arg_check: false
13 :callback_include_count: false
14 :treat_externs: :include
15
16 :systest:
17 :types: |
18 typedef struct _POINT_T {
19 int x;
20 int y;
21 } POINT_T;
22
23 :mockable: |
24 #include "CException.h"
25 extern void foo(POINT_T* a);
26 POINT_T* bar(void);
27 void no_args(void);
28
29 :source:
30 :header: |
31 #include "CException.h"
32 void function_a(void);
33 int function_b(void);
34
35 :code: |
36 void function_a(void)
37 {
38 foo(bar());
39 no_args();
40 }
41
42 int function_b(void)
43 {
44 POINT_T pt = { 1, 2 };
45 foo(&pt);
46 return (pt.x + pt.y);
47 }
48
49 :tests:
50 :common: |
51 #include "CException.h"
52 void setUp(void) {}
53 void tearDown(void) {}
54 void my_foo_callback(POINT_T* a) { TEST_ASSERT_EQUAL_INT(2, a->x); }
55
56 :units:
57 - :pass: TRUE
58 :should: 'just pass if we do not insert anything ugly into it'
59 :code: |
60 test()
61 {
62 bar_ExpectAndReturn(NULL);
63 foo_Expect(NULL);
64 no_args_Expect();
65
66 function_a();
67 }
68
69 - :pass: FALSE
70 :should: 'not contain mock details in failed assertion after an expect and return'
71 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
72 :code: |
73 test()
74 {
75 bar_ExpectAndReturn(NULL);
76 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
77 foo_Expect(NULL);
78 no_args_Expect();
79
80 function_a();
81 }
82
83 - :pass: FALSE
84 :should: 'not contain mock details in failed assertion after an expect'
85 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
86 :code: |
87 test()
88 {
89 bar_ExpectAndReturn(NULL);
90 foo_Expect(NULL);
91 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
92 no_args_Expect();
93
94 function_a();
95 }
96
97 - :pass: FALSE
98 :should: 'not contain mock details in failed assertion after throw expectation'
99 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
100 :code: |
101 test()
102 {
103 CEXCEPTION_T e;
104
105 bar_ExpectAndReturn(NULL);
106 foo_Expect(NULL);
107 no_args_ExpectAndThrow(5);
108 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
109
110 Try { function_a(); } Catch(e) {}
111 }
112
113 - :pass: FALSE
114 :should: 'not contain mock details in failed assertion after a mock call'
115 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
116 :code: |
117 test()
118 {
119 bar_ExpectAndReturn(NULL);
120 foo_Expect(NULL);
121 no_args_Expect();
122
123 function_a();
124
125 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
126 }
127
128 - :pass: FALSE
129 :should: 'not contain mock details in failed assertion after throw'
130 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
131 :code: |
132 test()
133 {
134 CEXCEPTION_T e;
135
136 bar_ExpectAndReturn(NULL);
137 foo_Expect(NULL);
138 no_args_ExpectAndThrow(5);
139
140 Try { function_a(); } Catch(e) {}
141
142 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
143 }
144
145 - :pass: FALSE
146 :should: 'not contain mock details in failed assertion after ignore'
147 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
148 :code: |
149 test()
150 {
151 bar_ExpectAndReturn(NULL);
152 foo_Expect(NULL);
153 no_args_Ignore();
154
155 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
156
157 function_a();
158 }
159
160 - :pass: FALSE
161 :should: 'not contain mock details in failed assertion after ignored mock'
162 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
163 :code: |
164 test()
165 {
166 bar_ExpectAndReturn(NULL);
167 foo_Expect(NULL);
168 no_args_Ignore();
169
170 function_a();
171
172 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
173 }
174
175 - :pass: FALSE
176 :should: 'not contain mock details in failed assertion after callback setup'
177 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
178 :code: |
179 test()
180 {
181 POINT_T pt = { 2, 2 };
182 bar_ExpectAndReturn(&pt);
183 foo_StubWithCallback(my_foo_callback);
184
185 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
186
187 no_args_Expect();
188
189 function_a();
190 }
191
192 - :pass: FALSE
193 :should: 'not contain mock details in failed assertion after mock with callback'
194 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
195 :code: |
196 test()
197 {
198 POINT_T pt = { 2, 2 };
199 bar_ExpectAndReturn(&pt);
200 foo_StubWithCallback(my_foo_callback);
201 no_args_Expect();
202
203 function_a();
204
205 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
206 }
207
208 - :pass: FALSE
209 :should: 'not contain mock details in failed assertion after expect any args'
210 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
211 :code: |
212 test()
213 {
214 POINT_T pt = { 2, 2 };
215 bar_ExpectAndReturn(&pt);
216 foo_ExpectAnyArgs();
217
218 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
219
220 no_args_Expect();
221
222 function_a();
223 }
224
225 - :pass: FALSE
226 :should: 'not contain mock details in failed assertion after mock which expected any args'
227 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
228 :code: |
229 test()
230 {
231 POINT_T pt = { 2, 2 };
232 bar_ExpectAndReturn(&pt);
233 foo_ExpectAnyArgs();
234 no_args_Expect();
235
236 function_a();
237
238 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
239 }
240
241 - :pass: FALSE
242 :should: 'not contain mock details in failed assertion after ignored arg'
243 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
244 :code: |
245 test()
246 {
247 POINT_T pt = { 2, 2 };
248 bar_ExpectAndReturn(&pt);
249 foo_Expect(NULL);
250 foo_IgnoreArg_a();
251
252 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
253
254 no_args_Expect();
255
256 function_a();
257 }
258
259 - :pass: FALSE
260 :should: 'not contain mock details in failed assertion after mock which ignored an arg'
261 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
262 :code: |
263 test()
264 {
265 POINT_T pt = { 2, 2 };
266 bar_ExpectAndReturn(&pt);
267 foo_Expect(NULL);
268 foo_IgnoreArg_a();
269 no_args_Expect();
270
271 function_a();
272
273 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
274 }
275
276 - :pass: FALSE
277 :should: 'not contain mock details in failed assertion after mock which threw a CException'
278 :verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
279 :code: |
280 test()
281 {
282 CEXCEPTION_T e;
283 bar_ExpectAndThrow(0x12);
284
285 Try {
286 function_a();
287 }
288 Catch(e) {}
289
290 TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
291 }
292
293 - :pass: FALSE
294 :should: 'not contain mock details in failed assertion after mock which used a return thru ptr'
295 :verify_error: 'FAIL: Expected 3 Was 7. CustomFail'
296 :code: |
297 test()
298 {
299 POINT_T pt1 = { 1, 2 };
300 POINT_T pt2 = { 3, 4 };
301
302 foo_Expect(&pt1);
303 foo_ReturnThruPtr_a(&pt2);
304
305 TEST_ASSERT_EQUAL_INT_MESSAGE(3, function_b(), "CustomFail");
306 }
307
308 ...