Debian Codegraph @

tests/mocks_tests.c

raw symbols SCIP
1 #cxx . . $ `<file>/tests/mocks_tests.c`/include <cgreen/boxed_double.h>cxx . . $ `<file>/include/cgreen/boxed_double.h`/
2 #include <cgreen/cgreen.h>cxx . . $ `<file>/include/cgreen/cgreen.h`/
3 #include <cgreen/mocks.h>cxx . . $ `<file>/include/cgreen/mocks.h`/
4 #include <cgreen/unit.h>cxx . . $ `<file>/include/cgreen/unit.h`/
5 #include <stdlib.h>
6
7 #ifdef __cpluspluscxx . . $ `<built-in>:440:9`!
8 using namespace cgreen;
9 #endif
10
11 Describecxx . . $ Dummy_Mocks#x.(Mocks);
12 BeforeEachcxx . . $ `include/cgreen/unit.h:15:9`!(Mocks) {}
13 AfterEachcxx . . $ AfterEach_For_Mocks_Function(49f6e7a06ebc5aa8).(Mocks) {}
14
15 static int integer_outcxx . . $ integer_out(b126dc7c1de90089).(void) {
16 return (int)mockcxx . . $ intptr_t#();
17 }
18
19 Ensurecxx . . $ Mocks__default_return_value_when_no_presets_for_loose_mock(49f6e7a06ebc5aa8).(Mocks, default_return_value_when_no_presets_for_loose_mock) {
20 cgreen_mocks_arecxx . . $ cgreen_mocks_are(366adfdc1bb4e579).(loose_mockscxx . . $ loose_mocks.);
21 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(0));
22 }
23
24 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, can_stub_an_integer_return) {
25 expectcxx . . $ intptr_t#(integer_out,
26 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(3)
27 );
28
29 assert_thatcxx . . $ integer_out(b126dc7c1de90089).(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3));
30 }
31
32 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, repeats_return_value_when_set_to_always) {
33 always_expectcxx . . $ `include/cgreen/mocks.h:23:9`!(integer_out,
34 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(3)
35 );
36
37 assert_thatcxx . . $ integer_out(b126dc7c1de90089).(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3));
38 assert_thatcxx . . $ integer_out(b126dc7c1de90089).(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3));
39 }
40
41 Ensurecxx . . $ contextForMocks.(Mocks, can_stub_an_integer_return_sequence) {
42 expectcxx . . $ Constraint#(integer_out,
43 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(1)
44 );
45
46 expectcxx . . $ Constraint#(integer_out,
47 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(2)
48 );
49
50 expectcxx . . $ cgreen/(integer_out,
51 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(3)
52 );
53
54 assert_thatcxx . . $ intptr_t#(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1));
55 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(2));
56 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3));
57 }
58
59 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, expectations_are_reset_between_tests_with_loose_mocks) {
60 cgreen_mocks_arecxx . . $ cgreen_mocks_are(366adfdc1bb4e579).(loose_mockscxx . . $ loose_mocks.);
61 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(integer_out(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(0));
62 }
63
64 static char *string_outcxx . . $ string_out(ff224f080444ee45).(int p1) {
65 return (char *)mockcxx . . $ intptr_t#(p1);
66 }
67
68 Ensurecxx . . $ Mocks__can_stub_a_string_return(49f6e7a06ebc5aa8).(Mocks, can_stub_a_string_return) {
69 expectcxx . . $ Constraint#(string_out, will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!("hello"));
70 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(string_out(1), is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("hello"));
71 }
72
73 Ensurecxx . . $ CgreenTest#(Mocks, can_stub_a_string_sequence) {
74 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(string_out, will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!("hello"));
75 expectcxx . . $ Constraint#(string_out, will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!("goodbye"));
76
77 assert_thatcxx . . $ cgreen/(string_out(2), is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("hello"));
78 assert_thatcxx . . $ string_out(ff224f080444ee45).(string_out(3), is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("goodbye"));
79 }
80
81 static void integer_incxx . . $ integer_in(d4f767463ce0a6b3).(int i) {
82 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(i);
83 }
84
85 Ensurecxx . . $ CgreenSpec__Mocks__expecting_once_with_any_parameters__.(Mocks, expecting_once_with_any_parameters) {
86 expectcxx . . $ Constraint#(integer_in);
87 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(3);
88 }
89
90 Ensurecxx . . $ CgreenSpec__Mocks__expecting_once_with_parameter_checks_that_parameter__.(Mocks, expecting_once_with_parameter_checks_that_parameter) {
91 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(integer_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3)));
92 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(3);
93 }
94
95 Ensurecxx . . $ contextForMocks.(Mocks, always_expect_keeps_affirming_parameter) {
96 always_expectcxx . . $ cgreen/(integer_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3)));
97 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(3);
98 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(3);
99 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(3);
100 }
101
102 Ensurecxx . . $ CgreenTest#(Mocks, expect_a_sequence) {
103 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(integer_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1)));
104 expectcxx . . $ Constraint#(integer_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(2)));
105 expectcxx . . $ cgreen/(integer_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3)));
106 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(1);
107 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(2);
108 integer_incxx . . $ integer_in(d4f767463ce0a6b3).(3);
109 }
110
111 static void string_incxx . . $ string_in(85c52e162fed56f9).(const char *s) {
112 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(s);
113 }
114
115 Ensurecxx . . $ contextForMocks.(Mocks, string_expect_is_confirmed) {
116 expectcxx . . $ cgreen/(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("hello")));
117 string_incxx . . $ string_in(85c52e162fed56f9).("hello");
118 }
119
120 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, string_contains_expectation_is_confirmed) {
121 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, contains_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:43:9`!("hello")));
122 string_incxx . . $ string_in(85c52e162fed56f9).("alice, hello");
123 }
124
125 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, string_expect_is_confirmed_even_when_null) {
126 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!((char *)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)));
127 string_incxx . . $ string_in(85c52e162fed56f9).(NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!);
128 }
129
130 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, string_expect_sequence) {
131 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("hello")));
132 expectcxx . . $ cgreen/(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("goodbye")));
133 string_incxx . . $ string_in(85c52e162fed56f9).("hello");
134 string_incxx . . $ string_in(85c52e162fed56f9).("goodbye");
135 }
136
137 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, expecting_once_with_non_null_parameter_checks_that_parameter) {
138 expectcxx . . $ cgreen/(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_non_nullcxx . . $ `include/cgreen/constraint_syntax_helpers.h:29:9`!));
139 string_incxx . . $ string_in(85c52e162fed56f9).("anything");
140 }
141
142 static void string_in2cxx . . $ string_in2(85c52e162fed56f9).(const char *s2) {
143 mockcxx . . $ intptr_t#(s2);
144 }
145
146 Ensurecxx . . $ CgreenTest#(Mocks, expecting_twice_with_non_null_constraint_should_not_mix_them_up) {
147 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_not_nullcxx . . $ `include/cgreen/constraint_syntax_helpers.h:30:9`!));
148 expectcxx . . $ Constraint#(string_in2, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s2, is_not_nullcxx . . $ `include/cgreen/constraint_syntax_helpers.h:30:9`!));
149 string_incxx . . $ string_in(85c52e162fed56f9).("anything");
150 string_in2cxx . . $ string_in2(85c52e162fed56f9).("anything");
151 }
152
153 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, expecting_twice_with_is_null_constraint_should_not_mix_them_up) {
154 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(string_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_nullcxx . . $ `include/cgreen/constraint_syntax_helpers.h:31:9`!));
155 expectcxx . . $ cgreen/(string_in2, whencxx . . $ `include/cgreen/mocks.h:38:9`!(s2, is_nullcxx . . $ `include/cgreen/constraint_syntax_helpers.h:31:9`!));
156 string_incxx . . $ string_in(85c52e162fed56f9).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
157 string_in2cxx . . $ string_in2(85c52e162fed56f9).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
158 }
159
160
161 static void bool_incxx . . $ bool_in(b45ddcbc8423892c).(boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! b) {
162 mockcxx . . $ intptr_t#(b);
163 }
164 static void bool_in2cxx . . $ bool_in2(b45ddcbc8423892c).(boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! b2) {
165 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(b2);
166 }
167
168 Ensurecxx . . $ CgreenTest#(Mocks, expecting_twice_with_is_true_constraint_should_not_mix_them_up) {
169 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(bool_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(b, is_truecxx . . $ `include/cgreen/constraint_syntax_helpers.h:33:9`!));
170 expectcxx . . $ cgreen/(bool_in2, whencxx . . $ `include/cgreen/mocks.h:38:9`!(b2, is_truecxx . . $ `include/cgreen/constraint_syntax_helpers.h:33:9`!));
171 bool_incxx . . $ bool_in(b45ddcbc8423892c).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
172 bool_in2cxx . . $ bool_in2(b45ddcbc8423892c).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
173 }
174
175 Ensurecxx . . $ Mocks__expecting_twice_with_is_false_constraint_should_not_mix_them_up(49f6e7a06ebc5aa8).(Mocks, expecting_twice_with_is_false_constraint_should_not_mix_them_up) {
176 expectcxx . . $ cgreen/(bool_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(b, is_falsecxx . . $ `include/cgreen/constraint_syntax_helpers.h:32:9`!));
177 expectcxx . . $ Constraint#(bool_in2, whencxx . . $ `include/cgreen/mocks.h:38:9`!(b2, is_falsecxx . . $ `include/cgreen/constraint_syntax_helpers.h:32:9`!));
178 bool_incxx . . $ bool_in(b45ddcbc8423892c).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
179 bool_in2cxx . . $ bool_in2(b45ddcbc8423892c).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
180 }
181
182 static void double_incxx . . $ double_in(ba8836b59fb42830).(double d) {
183 mockcxx . . $ intptr_t#(box_double(d));
184 }
185
186 Ensurecxx . . $ contextForMocks.(Mocks, double_expect_is_confirmed) {
187 expectcxx . . $ cgreen/(double_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(d, is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(3.14)));
188 double_incxx . . $ double_in(ba8836b59fb42830).(3.14);
189 }
190
191 Ensurecxx . . $ CgreenTest#(Mocks, double_expect_sequence) {
192 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(double_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(d, is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(1.0)));
193 expectcxx . . $ Constraint#(double_in, whencxx . . $ `include/cgreen/mocks.h:38:9`!(d, is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(2.0)));
194 double_incxx . . $ double_in(ba8836b59fb42830).(1.0);
195 double_incxx . . $ double_in(ba8836b59fb42830).(2.0);
196 }
197
198
199 /* non-static to avoid "unused" warning in C++ as long as
200 'can_always_return_double' does not work in C++ */
201 double double_outcxx . . $ double_out(31fa7155c10fdd13).(void) {
202 /* TODO: For v2 this should change to "return mock_double();" */
203 return unbox_doublecxx . . $ unbox_double(66f4a6ec74012662).(mockcxx . . $ intptr_t#());
204 }
205
206 #ifndef __cpluspluscxx . . $ `<built-in>:440:9`!
207 /* TODO: This does not work in C++ because of the overloading of
208 assert_that() which currently has no match for double */
209 Ensurecxx . . $ Mocks__can_return_double(49f6e7a06ebc5aa8).(Mocks, can_return_double) {
210 expectcxx . . $ Constraint#(double_out, will_return_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:60:9`!(4.23));
211 assert_that_doublecxx . . $ `include/cgreen/assertions.h:31:9`!(double_out(), is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(4.23));
212 }
213
214 Ensurecxx . . $ CgreenTest#(Mocks, can_always_return_double) {
215 always_expectcxx . . $ Constraint#(double_out, will_return_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:60:9`!(4.23));
216 assert_that_doublecxx . . $ `include/cgreen/assertions.h:31:9`!(double_out(), is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(4.23));
217 assert_that_doublecxx . . $ double_out(31fa7155c10fdd13).(double_out(), is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(4.23));
218 assert_that_doublecxx . . $ `include/cgreen/assertions.h:31:9`!(double_out(), is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(4.23));
219 }
220 #endif
221
222
223 typedef structcxx . . $ $anonymous_type_236e313c7c527f11_0# {
224 int fieldcxx . . $ $anonymous_type_236e313c7c527f11_0#field.;
225 } Scxx . . $ S#;
226
227 /* The mock function */
228 Scxx . . $ S# funccxx . . $ func(5b9f8da7f87a61ca).(void) {
229 Scxx . . $ S# s;
230 Scxx . . $ S# *sp;
231
232 sp = (Scxx . . $ S# *)mockcxx . . $ intptr_t#();
233
234 /* Copy content of struct pointed to by returned value */
235 memcpycxx . . $ memcpy(cc817cb175f282d).(&s, sp, sizeof(Scxx . . $ S#));
236
237 /* Return it */
238 return s;
239 }
240
241 Ensurecxx . . $ CgreenTest#(Mocks, can_return_struct) {
242 /* Allocate a struct */
243 Scxx . . $ S# *sp = (Scxx . . $ S# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(Scxx . . $ S#));
244
245 /* Prime one field */
246 sp->fieldcxx . . $ $anonymous_type_236e313c7c527f11_0#field. = 42;
247
248 /* Expect a call and return a pointer to the struct */
249 expectcxx . . $ intptr_t#(func, will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(sp));
250
251 /* Call our mock function which returns a struct */
252 Scxx . . $ S# ret = funccxx . . $ func(5b9f8da7f87a61ca).();
253
254 /* And assert that the field in the returned struct is propagated */
255 assert_thatcxx . . $ intptr_t#(ret.field, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(42));
256
257 freecxx . . $ free(5d22bdacc48458e8).(sp);
258 }
259
260 static void mixed_parameterscxx . . $ mixed_parameters(66835f578de1bcb3).(int i, const char *s) {
261 mockcxx . . $ intptr_t#(i, s);
262 }
263
264 Ensurecxx . . $ CgreenTest#(Mocks, confirming_multiple_parameters_multiple_times) {
265 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(mixed_parameters,
266 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1)),
267 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("Hello"))
268 );
269 expectcxx . . $ intptr_t#(mixed_parameters,
270 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(2)),
271 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("Goodbye"))
272 );
273
274 mixed_parameterscxx . . $ mixed_parameters(66835f578de1bcb3).(1, "Hello");
275 mixed_parameterscxx . . $ mixed_parameters(66835f578de1bcb3).(2, "Goodbye");
276 }
277
278 static int sample_mockcxx . . $ sample_mock(95e580389a7cc305).(int i, const char *s) {
279 return (int)mockcxx . . $ intptr_t#(i, s);
280 }
281
282 Ensurecxx . . $ Mocks__can_mock_full_function_call(49f6e7a06ebc5aa8).(Mocks, can_mock_full_function_call) {
283 expectcxx . . $ intptr_t#(sample_mock,
284 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(5),
285 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(666)),
286 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("devil"))
287 );
288
289 assert_thatcxx . . $ intptr_t#(sample_mock(666, "devil"), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(5));
290 }
291
292 Ensurecxx . . $ CgreenSpec__Mocks__when_called_with_always_should_not_tally_counts__.(Mocks, when_called_with_always_should_not_tally_counts) {
293 always_expectcxx . . $ cgreen/(string_out,
294 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(5),
295 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(666)),
296 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("devil"))
297 );
298 }
299
300 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, can_mock_full_sequence) {
301 expectcxx . . $ cgreen/(sample_mock,
302 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(5),
303 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(666)),
304 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("devil"))
305 );
306
307 expectcxx . . $ Constraint#(sample_mock,
308 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(6),
309 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(667)),
310 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("beastie"))
311 );
312
313 assert_thatcxx . . $ cgreen/(sample_mock(666, "devil"), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(5));
314 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(sample_mock(667, "beastie"), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(6));
315 }
316
317 Ensurecxx . . $ CgreenSpec__Mocks__can_always_mock_full_function_call__.(Mocks, can_always_mock_full_function_call) {
318 always_expectcxx . . $ cgreen/(sample_mock,
319 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(5),
320 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(666)),
321 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("devil"))
322 );
323
324 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(sample_mock(666, "devil"), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(5));
325 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(sample_mock(666, "devil"), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(5));
326 assert_thatcxx . . $ intptr_t#(sample_mock(666, "devil"), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(5));
327 }
328
329 static void sample_mock_with_parameters_without_space_between_themcxx . . $ sample_mock_with_parameters_without_space_between_them(66835f578de1bcb3).(int i, const char *s) {
330 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(i,s);
331 }
332
333 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, can_mock_full_function_call_when_there_is_no_space_between_parameters) {
334 expectcxx . . $ cgreen/(sample_mock_with_parameters_without_space_between_them,
335 whencxx . . $ `include/cgreen/mocks.h:38:9`!(i, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(666)),
336 whencxx . . $ `include/cgreen/mocks.h:38:9`!(s, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!("devil"))
337 );
338
339 sample_mock_with_parameters_without_space_between_themcxx . . $ sample_mock_with_parameters_without_space_between_them(66835f578de1bcb3).(666, "devil");
340 }
341
342 typedef structcxx . . $ $anonymous_type_236e313c7c527f11_1# {
343 double acxx . . $ $anonymous_type_236e313c7c527f11_1#a.;
344 double bcxx . . $ $anonymous_type_236e313c7c527f11_1#b.;
345 const char *namecxx . . $ $anonymous_type_236e313c7c527f11_1#name.;
346 } LargerThanIntptrcxx . . $ LargerThanIntptr#;
347
348 static void out_param_mockcxx . . $ out_param_mock(a4abbca32803e784).(LargerThanIntptrcxx . . $ LargerThanIntptr#* result) {
349 mockcxx . . $ intptr_t#(result);
350 }
351
352
353 Ensurecxx . . $ CgreenSpec__Mocks__can_stub_an_out_parameter__.(Mocks, can_stub_an_out_parameter) {
354 LargerThanIntptrcxx . . $ LargerThanIntptr# actual = { 3.14, 6.66, "bob" };
355 LargerThanIntptrcxx . . $ LargerThanIntptr# local = { 4.13, 7.89, "alice" };
356
357 expectcxx . . $ intptr_t#(out_param_mock,
358 will_set_contents_of_output_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:62:9`!(result, &actual, sizeof(LargerThanIntptr))
359 );
360
361 out_param_mockcxx . . $ out_param_mock(a4abbca32803e784).(&local);
362 assert_that_doublecxx . . $ $anonymous_type_236e313c7c527f11_1#a.(actual.a, is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(local.a));
363 assert_that_doublecxx . . $ `include/cgreen/assertions.h:31:9`!(actual.b, is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(local.b));
364 assert_thatcxx . . $ cgreen/(actual.name, is_equal_to_stringcxx . . $ `include/cgreen/constraint_syntax_helpers.h:41:9`!(local.name));
365 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(&local, is_equal_to_contents_ofcxx . . $ `include/cgreen/constraint_syntax_helpers.h:38:9`!(&actual, sizeof(LargerThanIntptr)));
366 }
367
368 static void mocked_readcxx . . $ mocked_read(fda57c8427c60377).(char *ch) {
369 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(ch);
370 }
371
372 Ensurecxx . . $ contextForMocks.(Mocks, can_stub_a_char_out_parameter) {
373 char stubbed_char = 'a';
374 char returned_char;
375 expectcxx . . $ Constraint#(mocked_read,
376 will_set_contents_of_output_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:62:9`!(ch, &stubbed_char, 1));
377 mocked_readcxx . . $ mocked_read(fda57c8427c60377).(&returned_char);
378 assert_thatcxx . . $ cgreen/(returned_char, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(stubbed_char));
379 }
380
381 static void int_out_mockcxx . . $ int_out_mock(11b0e290e57a7e53).(int *out) {
382 mockcxx . . $ intptr_t#(out);
383 }
384
385 /* Issue #337: the source value must be copied at expect() time, not
386 referenced at mock-call time. Here the source is a local in a helper
387 that has already returned -- and whose stack slot is reused by the
388 second call -- before the mock runs. */
389 static void queue_int_outputcxx . . $ queue_int_output(d4f767463ce0a6b3).(int value) {
390 int local = value;
391 expectcxx . . $ intptr_t#(int_out_mock, will_set_contents_of_output_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:62:9`!(out, &local, sizeof(local)));
392 }
393
394 Ensurecxx . . $ CgreenSpec__Mocks__set_contents_copies_source_value_at_expect_time__.(Mocks, set_contents_copies_source_value_at_expect_time) {
395 queue_int_outputcxx . . $ queue_int_output(d4f767463ce0a6b3).(111);
396 queue_int_outputcxx . . $ queue_int_output(d4f767463ce0a6b3).(222);
397
398 int first = 0, second = 0;
399 int_out_mockcxx . . $ int_out_mock(11b0e290e57a7e53).(&first);
400 int_out_mockcxx . . $ int_out_mock(11b0e290e57a7e53).(&second);
401
402 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(first, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(111));
403 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(second, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(222));
404 }
405
406 Ensurecxx . . $ contextForMocks.(Mocks, can_set_a_scalar_int_output_parameter_from_a_literal) {
407 int result = 0;
408 expectcxx . . $ intmax_t#(int_out_mock, will_set_scalar_output_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:63:9`!(out, 42));
409 int_out_mockcxx . . $ int_out_mock(11b0e290e57a7e53).(&result);
410 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(result, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(42));
411 }
412
413 static void short_out_mockcxx . . $ short_out_mock(48f4dc425c7fc6aa).(short *out) {
414 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(out);
415 }
416
417 Ensurecxx . . $ Mocks__can_set_a_scalar_short_output_parameter(49f6e7a06ebc5aa8).(Mocks, can_set_a_scalar_short_output_parameter) {
418 short result = 0;
419 expectcxx . . $ cgreen/(short_out_mock, will_set_scalar_output_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:63:9`!(out, (short)0x1234));
420 short_out_mockcxx . . $ short_out_mock(48f4dc425c7fc6aa).(&result);
421 assert_thatcxx . . $ cgreen/assert_that_(b064aa216885589).(result, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(0x1234));
422 }
423
424 static void long_long_out_mockcxx . . $ long_long_out_mock(443af28443ef864).(long long *out) {
425 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(out);
426 }
427
428 /* The width follows the value's own type via sizeof(value): a >32-bit value
429 through a long long out-parameter must survive whole (not truncated to int). */
430 Ensurecxx . . $ CgreenTest#(Mocks, scalar_output_parameter_width_follows_the_value_type) {
431 long long result = 0;
432 expectcxx . . $ Constraint#(long_long_out_mock, will_set_scalar_output_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:63:9`!(out, 0x1122334455LL));
433 long_long_out_mockcxx . . $ long_long_out_mock(443af28443ef864).(&result);
434 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(result, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(0x1122334455LL));
435 }
436
437 /* Issue #202: a mock called with a NULL out-parameter must not write into it. */
438 Ensurecxx . . $ CgreenTest#(Mocks, set_contents_does_not_write_to_a_null_out_parameter) {
439 int value = 42;
440 expectcxx . . $ Constraint#(int_out_mock, will_set_contents_of_output_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:62:9`!(out, &value, sizeof(value)));
441 int_out_mockcxx . . $ int_out_mock(11b0e290e57a7e53).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!); /* used to segfault by writing into NULL */
442 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); /* reaching here means it did not crash */
443 }
444
445 // function which when mocked will be referred to by preprocessor macro
446 static void function_macro_mockcxx . . $ function_macro_mock(49f6e7a06ebc5aa8).(void) {
447 mockcxx . . $ intptr_t#();
448 }
449
450 #define FUNCTION_MACROcxx . . $ `tests/mocks_tests.c:450:9`! function_macro_mock
451
452 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, can_mock_a_function_macro) {
453
454 // expect to mock by real function name
455 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(function_macro_mock);
456
457 function_macro_mockcxx . . $ function_macro_mock(49f6e7a06ebc5aa8).();
458
459 // expect to mock by macro function name
460 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(FUNCTION_MACROcxx . . $ `tests/mocks_tests.c:450:9`!);
461
462 FUNCTION_MACROcxx . . $ function_macro_mock(49f6e7a06ebc5aa8).();
463 }
464
465 #undef FUNCTION_MACROcxx . . $ `tests/mocks_tests.c:450:9`!
466
467 static void simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(int first, int second) {
468 mockcxx . . $ `include/cgreen/mocks.h:34:9`!(first, second);
469 }
470
471 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, constraint_number_of_calls_when_no_when_is_present) {
472 expectcxx . . $ Constraint#(simple_mocked_function, timescxx . . $ `include/cgreen/mocks.h:40:9`!(2));
473 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
474 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
475 }
476
477 Ensurecxx . . $ CgreenSpec__Mocks__constraint_number_of_calls_when_is_present__.(Mocks, constraint_number_of_calls_when_is_present) {
478 expectcxx . . $ cgreen/(simple_mocked_function, whencxx . . $ `include/cgreen/mocks.h:38:9`!(first, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1)), timescxx . . $ `include/cgreen/mocks.h:40:9`!(2));
479 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
480 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
481 }
482
483 Ensurecxx . . $ contextForMocks.(Mocks, constraint_number_of_calls_when_multiple_expectations_are_present) {
484 expectcxx . . $ `include/cgreen/mocks.h:21:9`!(simple_mocked_function, whencxx . . $ `include/cgreen/mocks.h:38:9`!(first, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1)), timescxx . . $ `include/cgreen/mocks.h:40:9`!(2));
485 expectcxx . . $ intptr_t#(simple_mocked_function, whencxx . . $ `include/cgreen/mocks.h:38:9`!(first, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(2)), timescxx . . $ `include/cgreen/mocks.h:40:9`!(1));
486 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
487 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
488 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(2, 2);
489 }
490
491 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, constraint_number_of_calls_order_of_expectations_matter) {
492 expectcxx . . $ Constraint#(simple_mocked_function, whencxx . . $ `include/cgreen/mocks.h:38:9`!(first, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1)), timescxx . . $ `include/cgreen/mocks.h:40:9`!(1));
493 expectcxx . . $ Constraint#(simple_mocked_function, whencxx . . $ `include/cgreen/mocks.h:38:9`!(first, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(2)), timescxx . . $ `include/cgreen/mocks.h:40:9`!(1));
494 expectcxx . . $ Constraint#(simple_mocked_function, whencxx . . $ `include/cgreen/mocks.h:38:9`!(first, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1)), timescxx . . $ `include/cgreen/mocks.h:40:9`!(1));
495 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
496 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(2, 2);
497 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(1, 2);
498 }
499
500 Ensurecxx . . $ CgreenSpec__Mocks__can_capture_parameter__.(Mocks, can_capture_parameter) {
501 int captured_first = 0;
502 int captured_second = 0;
503
504 expectcxx . . $ cgreen/(simple_mocked_function,
505 will_capture_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:64:9`!(first, captured_first),
506 will_capture_parametercxx . . $ `include/cgreen/constraint_syntax_helpers.h:64:9`!(second, captured_second));
507 simple_mocked_functioncxx . . $ simple_mocked_function(3e454b8ccf442868).(0x12345678, 0x76543210);
508 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(captured_first, is_equal_to_hexcxx . . $ `include/cgreen/constraint_syntax_helpers.h:27:9`!(0x12345678));
509 assert_thatcxx . . $ cgreen/(captured_second, is_equal_to_hexcxx . . $ `include/cgreen/constraint_syntax_helpers.h:27:9`!(0x76543210));
510 }
511
512 static int changed_by_sideeffectcxx . . $ changed_by_sideeffect. = 1;
513 static int mock_with_side_effectcxx . . $ mock_with_side_effect(b126dc7c1de90089).(void) {
514 return (int)mockcxx . . $ intptr_t#();
515 }
516 static void the_sideeffectcxx . . $ the_sideeffect(5d22bdacc48458e8).(void * data) {
517 assert_thatcxx . . $ intptr_t#(*(int*)data, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(99));
518 changed_by_sideeffectcxx . . $ changed_by_sideeffect. = 2;
519 }
520
521 Ensurecxx . . $ CgreenTest#(Mocks, mock_expect_with_side_effect) {
522 int data_passed_to_sideeffect = 99;
523 expectcxx . . $ Constraint#(mock_with_side_effect,
524 with_side_effectcxx . . $ `include/cgreen/constraint_syntax_helpers.h:57:9`!(&the_sideeffect, &data_passed_to_sideeffect),
525 will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(22));
526
527 assert_thatcxx . . $ mock_with_side_effect(b126dc7c1de90089).(mock_with_side_effect(), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(22));
528
529 assert_thatcxx . . $ intptr_t#(changed_by_sideeffect, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(2));
530 }
531
532
533 typedef struct Structcxx . . $ Struct# {
534 int heightcxx . . $ Struct#height.;
535 int weightcxx . . $ Struct#weight.;
536 } Structcxx . . $ Struct#;
537
538 Structcxx . . $ Struct# retrieveStructcxx . . $ retrieveStruct(51d814500ef3c86b).(void) {
539 Structcxx . . $ Struct# *struct_p = (Structcxx . . $ Struct# *)mockcxx . . $ intptr_t#();
540 Structcxx . . $ Struct# the_struct = *struct_p;
541 freecxx . . $ free(5d22bdacc48458e8).(struct_p);
542 return the_struct;
543 }
544
545 Ensurecxx . . $ CgreenTest#(Mocks, can_return_by_value) {
546 Structcxx . . $ Struct# someStruct = {.height = 10, .weight = 20};
547 expectcxx . . $ Struct#(retrieveStruct, will_return_by_valuecxx . . $ `include/cgreen/constraint_syntax_helpers.h:59:9`!(someStruct, sizeof(Struct)));
548 someStruct.heightcxx . . $ Struct#height. = 30;
549
550 Structcxx . . $ Struct# actualStruct = retrieveStructcxx . . $ retrieveStruct(51d814500ef3c86b).();
551 assert_thatcxx . . $ intptr_t#(actualStruct.weight, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(20));
552 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(actualStruct.height, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(10));
553 }
554
555 Ensurecxx . . $ contextForMocks.(Mocks, can_return_by_value_without_a_size) {
556 Structcxx . . $ Struct# someStruct = {.height = 10, .weight = 20};
557 expectcxx . . $ cgreen/(retrieveStruct, will_return_by_valuecxx . . $ `include/cgreen/constraint_syntax_helpers.h:59:9`!(someStruct)); /* size taken from sizeof(someStruct) */
558 someStruct.heightcxx . . $ Struct#height. = 30;
559
560 Structcxx . . $ Struct# actualStruct = retrieveStructcxx . . $ retrieveStruct(51d814500ef3c86b).();
561 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(actualStruct.weight, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(20));
562 assert_thatcxx . . $ intptr_t#(actualStruct.height, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(10));
563 }
564
565 Structcxx . . $ Struct# retrieveSpecialStructcxx . . $ retrieveSpecialStruct(dd7fb83bae9fb567).(int structNumber) {
566 Structcxx . . $ Struct# *struct_p = (Structcxx . . $ Struct# *)mockcxx . . $ intptr_t#(structNumber);
567 Structcxx . . $ Struct# the_struct = *struct_p;
568 freecxx . . $ free(5d22bdacc48458e8).(struct_p);
569 return the_struct;
570 }
571
572 Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(Mocks, can_return_by_value_depending_on_input_parameter) {
573 Structcxx . . $ Struct# struct1 = {.height = 10, .weight = 20};
574 Structcxx . . $ Struct# struct2 = {.height = 5, .weight = 33};
575 expectcxx . . $ intptr_t#(retrieveSpecialStruct, will_return_by_valuecxx . . $ `include/cgreen/constraint_syntax_helpers.h:59:9`!(struct1, sizeof(Struct)),
576 whencxx . . $ `include/cgreen/mocks.h:38:9`!(structNumber, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(1)));
577 expectcxx . . $ Struct#(retrieveSpecialStruct, will_return_by_valuecxx . . $ `include/cgreen/constraint_syntax_helpers.h:59:9`!(struct2, sizeof(Struct)),
578 whencxx . . $ `include/cgreen/mocks.h:38:9`!(structNumber, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(2)));
579 struct1.heightcxx . . $ Struct#height. = 30;
580
581 Structcxx . . $ Struct# retrievedStruct1 = retrieveSpecialStructcxx . . $ retrieveSpecialStruct(dd7fb83bae9fb567).(1);
582 assert_thatcxx . . $ Struct#weight.(retrievedStruct1.weight, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(20));
583 assert_thatcxx . . $ cgreen/(retrievedStruct1.height, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(10));
584 Structcxx . . $ Struct# retrievedStruct2 = retrieveSpecialStructcxx . . $ retrieveSpecialStruct(dd7fb83bae9fb567).(2);
585 assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(retrievedStruct2.weight, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(33));
586 assert_thatcxx . . $ Struct#height.(retrievedStruct2.height, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(5));
587 }
588
589 TestSuitecxx . . $ TestSuite# *mock_testscxx . . $ mock_tests(564401a81ded3a53).(void) {
590 TestSuitecxx . . $ TestSuite# *suite = create_test_suitecxx . . $ `include/cgreen/suite.h:20:9`!();
591 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, default_return_value_when_no_presets_for_loose_mock);
592 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_stub_an_integer_return);
593 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, repeats_return_value_when_set_to_always);
594 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_stub_an_integer_return_sequence);
595 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, expectations_are_reset_between_tests_with_loose_mocks);
596 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_stub_a_string_return);
597 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_stub_a_string_sequence);
598 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, expecting_once_with_any_parameters);
599 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, expecting_once_with_parameter_checks_that_parameter);
600 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, always_expect_keeps_affirming_parameter);
601 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, expect_a_sequence);
602 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, string_expect_is_confirmed);
603 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, string_expect_is_confirmed_even_when_null);
604 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, string_expect_sequence);
605 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, expecting_once_with_non_null_parameter_checks_that_parameter);
606 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, double_expect_is_confirmed);
607 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, double_expect_sequence);
608 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, confirming_multiple_parameters_multiple_times);
609 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_mock_full_function_call);
610 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, when_called_with_always_should_not_tally_counts);
611 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_mock_full_sequence);
612 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_always_mock_full_function_call);
613 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_mock_full_function_call_when_there_is_no_space_between_parameters);
614 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_stub_an_out_parameter);
615 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, set_contents_copies_source_value_at_expect_time);
616 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_set_a_scalar_int_output_parameter_from_a_literal);
617 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_set_a_scalar_short_output_parameter);
618 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, scalar_output_parameter_width_follows_the_value_type);
619 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, set_contents_does_not_write_to_a_null_out_parameter);
620 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, string_contains_expectation_is_confirmed);
621 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_mock_a_function_macro);
622 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, constraint_number_of_calls_when_no_when_is_present);
623 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, constraint_number_of_calls_when_is_present);
624 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, constraint_number_of_calls_when_multiple_expectations_are_present);
625 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, constraint_number_of_calls_order_of_expectations_matter);
626 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, mock_expect_with_side_effect);
627 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_return_by_value);
628 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_return_by_value_without_a_size);
629 add_test_with_contextcxx . . $ `include/cgreen/suite.h:23:9`!(suite, Mocks, can_return_by_value_depending_on_input_parameter);
630
631 return suite;
632 }