Mercurial > molko
comparison tests/test-action.c @ 514:daf085bf8a8c
misc: fix build
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 04 Mar 2023 10:49:20 +0100 |
parents | c1f64d451230 |
children | c7664b679a95 |
comparison
equal
deleted
inserted
replaced
513:b59a1f00bf80 | 514:daf085bf8a8c |
---|---|
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 */ | 17 */ |
18 | 18 |
19 #include <mlk/core/util.h> | |
20 | |
19 #include <mlk/core/action-stack.h> | 21 #include <mlk/core/action-stack.h> |
20 #include <mlk/core/action.h> | 22 #include <mlk/core/action.h> |
21 #include <mlk/core/err.h> | 23 #include <mlk/core/err.h> |
22 #include <mlk/core/event.h> | 24 #include <mlk/core/event.h> |
23 | 25 |
207 } | 209 } |
208 | 210 |
209 static void | 211 static void |
210 test_stack_add(void) | 212 test_stack_add(void) |
211 { | 213 { |
214 struct mlk_action act = {0}; | |
212 struct mlk_action *actions[10]; | 215 struct mlk_action *actions[10]; |
213 struct mlk_action_stack st = {0}; | 216 struct mlk_action_stack st = { |
214 struct mlk_action act = {0}; | 217 .actions = actions, |
215 | 218 .actionsz = MLK_UTIL_SIZE(actions) |
216 mlk_action_stack_init(&st, actions, 10); | 219 }; |
220 | |
221 mlk_action_stack_init(&st); | |
217 | 222 |
218 DT_EQ_INT(mlk_action_stack_add(&st, &act), 0); | 223 DT_EQ_INT(mlk_action_stack_add(&st, &act), 0); |
219 | 224 |
220 /* Now fill up. */ | 225 /* Now fill up. */ |
221 for (int i = 0; i < 9; ++i) | 226 for (int i = 0; i < 9; ++i) |
235 { .act = INIT(&table[0], my_update_true) }, | 240 { .act = INIT(&table[0], my_update_true) }, |
236 { .act = INIT(&table[1], my_update_true) }, | 241 { .act = INIT(&table[1], my_update_true) }, |
237 }; | 242 }; |
238 | 243 |
239 struct mlk_action *actions[10]; | 244 struct mlk_action *actions[10]; |
240 struct mlk_action_stack st = {0}; | 245 struct mlk_action_stack st = { |
241 | 246 .actions = actions, |
242 mlk_action_stack_init(&st, actions, 10); | 247 .actionsz = MLK_UTIL_SIZE(actions) |
248 }; | |
249 | |
250 mlk_action_stack_init(&st); | |
243 mlk_action_stack_add(&st, &table[0].act); | 251 mlk_action_stack_add(&st, &table[0].act); |
244 mlk_action_stack_add(&st, &table[1].act); | 252 mlk_action_stack_add(&st, &table[1].act); |
245 mlk_action_stack_start(&st); | 253 mlk_action_stack_start(&st); |
246 | 254 |
247 DT_ASSERT(table[0].inv.start); | 255 DT_ASSERT(table[0].inv.start); |
269 { .act = INIT(&table[0], my_update_true) }, | 277 { .act = INIT(&table[0], my_update_true) }, |
270 { .act = INIT(&table[1], my_update_true) }, | 278 { .act = INIT(&table[1], my_update_true) }, |
271 }; | 279 }; |
272 | 280 |
273 struct mlk_action *actions[10]; | 281 struct mlk_action *actions[10]; |
274 struct mlk_action_stack st = {0}; | 282 struct mlk_action_stack st = { |
275 | 283 .actions = actions, |
276 mlk_action_stack_init(&st, actions, 10); | 284 .actionsz = MLK_UTIL_SIZE(actions) |
285 }; | |
286 | |
287 mlk_action_stack_init(&st); | |
277 mlk_action_stack_add(&st, &table[0].act); | 288 mlk_action_stack_add(&st, &table[0].act); |
278 mlk_action_stack_add(&st, &table[1].act); | 289 mlk_action_stack_add(&st, &table[1].act); |
279 mlk_action_stack_handle(&st, &dummy); | 290 mlk_action_stack_handle(&st, &dummy); |
280 | 291 |
281 DT_ASSERT(!table[0].inv.start); | 292 DT_ASSERT(!table[0].inv.start); |
308 { .act = INIT(&table[5], my_update_true) }, | 319 { .act = INIT(&table[5], my_update_true) }, |
309 { .act = INIT(&table[6], my_update_false) }, | 320 { .act = INIT(&table[6], my_update_false) }, |
310 }; | 321 }; |
311 | 322 |
312 struct mlk_action *actions[10]; | 323 struct mlk_action *actions[10]; |
313 struct mlk_action_stack st = {0}; | 324 struct mlk_action_stack st = { |
314 | 325 .actions = actions, |
315 mlk_action_stack_init(&st, actions, 10); | 326 .actionsz = MLK_UTIL_SIZE(actions) |
327 }; | |
328 | |
329 mlk_action_stack_init(&st); | |
316 mlk_action_stack_add(&st, &table[0].act); | 330 mlk_action_stack_add(&st, &table[0].act); |
317 mlk_action_stack_add(&st, &table[1].act); | 331 mlk_action_stack_add(&st, &table[1].act); |
318 mlk_action_stack_add(&st, &table[2].act); | 332 mlk_action_stack_add(&st, &table[2].act); |
319 mlk_action_stack_add(&st, &table[3].act); | 333 mlk_action_stack_add(&st, &table[3].act); |
320 mlk_action_stack_add(&st, &table[4].act); | 334 mlk_action_stack_add(&st, &table[4].act); |
407 { .act = INIT(&table[5], my_update_true) }, | 421 { .act = INIT(&table[5], my_update_true) }, |
408 { .act = INIT(&table[6], my_update_false) }, | 422 { .act = INIT(&table[6], my_update_false) }, |
409 }; | 423 }; |
410 | 424 |
411 struct mlk_action *actions[10]; | 425 struct mlk_action *actions[10]; |
412 struct mlk_action_stack st = {0}; | 426 struct mlk_action_stack st = { |
413 | 427 .actions = actions, |
414 mlk_action_stack_init(&st, actions, 10); | 428 .actionsz = MLK_UTIL_SIZE(actions) |
429 }; | |
430 | |
431 mlk_action_stack_init(&st); | |
415 mlk_action_stack_add(&st, &table[0].act); | 432 mlk_action_stack_add(&st, &table[0].act); |
416 mlk_action_stack_add(&st, &table[1].act); | 433 mlk_action_stack_add(&st, &table[1].act); |
417 mlk_action_stack_add(&st, &table[2].act); | 434 mlk_action_stack_add(&st, &table[2].act); |
418 mlk_action_stack_add(&st, &table[3].act); | 435 mlk_action_stack_add(&st, &table[3].act); |
419 mlk_action_stack_add(&st, &table[4].act); | 436 mlk_action_stack_add(&st, &table[4].act); |
472 { .act = INIT(&table[0], my_update_true) }, | 489 { .act = INIT(&table[0], my_update_true) }, |
473 { .act = INIT(&table[1], my_update_false) }, | 490 { .act = INIT(&table[1], my_update_false) }, |
474 }; | 491 }; |
475 | 492 |
476 struct mlk_action *actions[10]; | 493 struct mlk_action *actions[10]; |
477 struct mlk_action_stack st = {0}; | 494 struct mlk_action_stack st = { |
478 | 495 .actions = actions, |
479 mlk_action_stack_init(&st, actions, 10); | 496 .actionsz = MLK_UTIL_SIZE(actions) |
497 }; | |
498 | |
499 mlk_action_stack_init(&st); | |
480 mlk_action_stack_add(&st, &table[0].act); | 500 mlk_action_stack_add(&st, &table[0].act); |
481 mlk_action_stack_add(&st, &table[1].act); | 501 mlk_action_stack_add(&st, &table[1].act); |
482 mlk_action_stack_finish(&st); | 502 mlk_action_stack_finish(&st); |
483 | 503 |
484 DT_ASSERT(!table[0].inv.handle); | 504 DT_ASSERT(!table[0].inv.handle); |