MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_append_structs

Function test_append_structs

common/test/run-utils-tal_arr_append.c:182–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182static void test_append_structs(void)
183{
184 struct foo {
185 int a;
186 int b;
187 };
188
189 struct foo *arr = tal_arr(NULL, struct foo, 1);
190 arr[0].a = 1;
191 arr[0].b = 2;
192
193 struct foo more[] = {
194 { 3, 4 },
195 { 5, 6 },
196 };
197
198 tal_arr_append(&arr, tal_dup_arr(arr, struct foo, more, ARRAY_SIZE(more), 0));
199
200 assert(tal_count(arr) == 3);
201 assert(arr[0].a == 1 && arr[0].b == 2);
202 assert(arr[1].a == 3 && arr[1].b == 4);
203 assert(arr[2].a == 5 && arr[2].b == 6);
204
205 tal_free(arr);
206}
207
208static void test_append_take(void)
209{

Callers 1

mainFunction · 0.85

Calls 1

tal_freeFunction · 0.85

Tested by

no test coverage detected