furi_event_test.c 759 B

12345678910111213141516171819202122232425262728293031
  1. #include "flipper_v2.h"
  2. #include "minunit.h"
  3. static void furi_concurent_app(void* p) {
  4. Event* event = p;
  5. signal_event(event);
  6. furiac_exit(NULL);
  7. }
  8. void test_furi_event() {
  9. Event event;
  10. mu_check(init_event(&event));
  11. // The event should not be signalled right after creation
  12. mu_check(!wait_event_with_timeout(&event, 100));
  13. // Create second app
  14. FuriApp* second_app __attribute__((unused)) =
  15. furiac_start(furi_concurent_app, "furi concurent app", (void*)&event);
  16. // The event should be signalled now
  17. mu_check(wait_event_with_timeout(&event, 100));
  18. // The event should not be signalled once it's processed
  19. mu_check(!wait_event_with_timeout(&event, 100));
  20. mu_check(delete_event(&event));
  21. }