Implement ValueManager and ValueComposer (#183)
* Fix ValueManager implementation * Implement ValueComposer * Add constructor for ValueManager * Add value-expanders.h to flipper_v2.h set * Move COPY_COMPOSE body into a .c file * Add test for ValueManager * Add destructors for ValueMutex, ValueManager and ValueComposer * Use destructors in tests * Move composition logic into perform_compose() * Add docs for perform_compose() * Add test for ValueComposer * Replace atomic_bool with bool as g++ compiler doesn't support C11 atomics * Add Event type * Add semaphore support to the local target * Add test for Event * Update input records and relevant examples * Rename Event to AppEvent in the cc1101-workaround example * Rename Event to AppEvent in the irda example * Use Event in ValueComposer to wait for update request * Add perform_compose_internal() function * fix Event/AppEvent Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
30
applications/tests/furi_event_test.c
Normal file
30
applications/tests/furi_event_test.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "flipper_v2.h"
|
||||
#include "minunit.h"
|
||||
|
||||
static void furi_concurent_app(void* p) {
|
||||
Event* event = p;
|
||||
|
||||
signal_event(event);
|
||||
|
||||
furiac_exit(NULL);
|
||||
}
|
||||
|
||||
void test_furi_event() {
|
||||
Event event;
|
||||
|
||||
mu_check(init_event(&event));
|
||||
|
||||
// The event should not be signalled right after creation
|
||||
mu_check(!wait_event_with_timeout(&event, 100));
|
||||
|
||||
// Create second app
|
||||
FuriApp* second_app = furiac_start(furi_concurent_app, "furi concurent app", (void*)&event);
|
||||
|
||||
// The event should be signalled now
|
||||
mu_check(wait_event_with_timeout(&event, 100));
|
||||
|
||||
// The event should not be signalled once it's processed
|
||||
mu_check(!wait_event_with_timeout(&event, 100));
|
||||
|
||||
mu_check(delete_event(&event));
|
||||
}
|
||||
Reference in New Issue
Block a user