ab75d2022d
Event handling: - Added unified event handling for application, system, and Wi‑Fi events. - Updated all apps to reflect event handling changes Wi-Fi: - Refactored event handling from listener interface to task & event group. - Added direct Wi‑Fi radio controls and improved event subscriptions. - Wi‑Fi screens now refresh asynchronously and handle unavailable devices more gracefully. - Enabled Wi‑Fi by default on in dts files, but radio on/off is still done by code. The main reason was reliable event subscription and consistent devicetree states. - Improved Wi‑Fi shutdown cleanup and radio-state handling. Other: - Renamed the Kernel Display app to Display.
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#include "doctest.h"
|
|
|
|
#include <tactility/concurrent/task_event_group.h>
|
|
|
|
TEST_CASE("task_event_group_wait_any wakes on any bit currently claimed in the group") {
|
|
TaskEventGroup group {};
|
|
task_event_group_construct(&group);
|
|
|
|
uint32_t bit_a, bit_b;
|
|
CHECK_EQ(task_event_group_claim_bit(&group, &bit_a), ERROR_NONE);
|
|
CHECK_EQ(task_event_group_claim_bit(&group, &bit_b), ERROR_NONE);
|
|
CHECK_NE(bit_a, bit_b);
|
|
|
|
CHECK_EQ(task_event_group_signal(&group, bit_b), ERROR_NONE);
|
|
|
|
uint32_t out_flags = 0;
|
|
CHECK_EQ(task_event_group_wait_any(&group, &out_flags, 0), ERROR_NONE);
|
|
CHECK_EQ(out_flags, bit_b);
|
|
|
|
task_event_group_destruct(&group);
|
|
}
|
|
|
|
TEST_CASE("task_event_group_wait_any times out immediately when the group has no claimed bits") {
|
|
TaskEventGroup group {};
|
|
task_event_group_construct(&group);
|
|
|
|
CHECK_EQ(task_event_group_wait_any(&group, nullptr, 0), ERROR_TIMEOUT);
|
|
|
|
task_event_group_destruct(&group);
|
|
}
|
|
|
|
TEST_CASE("task_event_group_wait_any times out when claimed bits exist but none are signalled") {
|
|
TaskEventGroup group {};
|
|
task_event_group_construct(&group);
|
|
|
|
uint32_t bit;
|
|
CHECK_EQ(task_event_group_claim_bit(&group, &bit), ERROR_NONE);
|
|
|
|
CHECK_EQ(task_event_group_wait_any(&group, nullptr, 0), ERROR_TIMEOUT);
|
|
|
|
task_event_group_destruct(&group);
|
|
}
|