Skip to content

Commit bb0d540

Browse files
author
Paul Thompson
committed
Add test to cover break_dispatch windup
1 parent 31f581c commit bb0d540

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

events/equeue/tests/tests.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,26 @@ void break_test(void) {
391391
equeue_destroy(&q);
392392
}
393393

394+
void break_no_windup_test(void) {
395+
equeue_t q;
396+
int err = equeue_create(&q, 2048);
397+
test_assert(!err);
398+
399+
int count = 0;
400+
equeue_call_every(&q, 0, simple_func, &count);
401+
402+
equeue_break(&q);
403+
equeue_break(&q);
404+
equeue_dispatch(&q, -1);
405+
test_assert(count == 1);
406+
407+
count = 0;
408+
equeue_dispatch(&q, 55);
409+
test_assert(count > 1);
410+
411+
equeue_destroy(&q);
412+
}
413+
394414
void period_test(void) {
395415
equeue_t q;
396416
int err = equeue_create(&q, 2048);
@@ -741,6 +761,7 @@ int main() {
741761
test_run(cancel_unnecessarily_test);
742762
test_run(loop_protect_test);
743763
test_run(break_test);
764+
test_run(break_no_windup_test);
744765
test_run(period_test);
745766
test_run(nested_test);
746767
test_run(sloth_test);

0 commit comments

Comments
 (0)