diff options
Diffstat (limited to 'test/common/event.c')
-rw-r--r-- | test/common/event.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/common/event.c b/test/common/event.c index 6037ae2ce3..c0912a3437 100644 --- a/test/common/event.c +++ b/test/common/event.c @@ -18,6 +18,8 @@ struct test_state { int val; }; +static bool called; + static int h_adder(void *ctx, struct event *event) { struct event_data_test *data = &event->data.test; @@ -28,6 +30,14 @@ static int h_adder(void *ctx, struct event *event) return 0; } +static int h_adder_simple(void) +{ + called = true; + + return 0; +} +EVENT_SPY_SIMPLE(EVT_TEST, h_adder_simple); + static int test_event_base(struct unit_test_state *uts) { struct test_state state; @@ -46,6 +56,18 @@ static int test_event_base(struct unit_test_state *uts) } COMMON_TEST(test_event_base, 0); +static int test_event_simple(struct unit_test_state *uts) +{ + called = false; + + /* Check that the handler is called */ + ut_assertok(event_notify_null(EVT_TEST)); + ut_assert(called); + + return 0; +} +COMMON_TEST(test_event_simple, 0); + static int h_probe(void *ctx, struct event *event) { struct test_state *test_state = ctx; |