furi_event_test.c 727 B

123456789101112131415161718192021222324252627282930
  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 = furiac_start(furi_concurent_app, "furi concurent app", (void*)&event);
  15. // The event should be signalled now
  16. mu_check(wait_event_with_timeout(&event, 100));
  17. // The event should not be signalled once it's processed
  18. mu_check(!wait_event_with_timeout(&event, 100));
  19. mu_check(delete_event(&event));
  20. }