Skip to content

Commit

Permalink
Add test to cover break_dispatch windup
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Thompson authored and geky committed Aug 4, 2019
1 parent b1ebdc5 commit 468d312
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,26 @@ void break_test(void) {
equeue_destroy(&q);
}

void break_no_windup_test(void) {
equeue_t q;
int err = equeue_create(&q, 2048);
test_assert(!err);

int count = 0;
equeue_call_every(&q, 0, simple_func, &count);

equeue_break(&q);
equeue_break(&q);
equeue_dispatch(&q, -1);
test_assert(count == 1);

count = 0;
equeue_dispatch(&q, 55);
test_assert(count > 1);

equeue_destroy(&q);
}

void period_test(void) {
equeue_t q;
int err = equeue_create(&q, 2048);
Expand Down Expand Up @@ -730,6 +750,7 @@ int main() {
test_run(cancel_unnecessarily_test);
test_run(loop_protect_test);
test_run(break_test);
test_run(break_no_windup_test);
test_run(period_test);
test_run(nested_test);
test_run(sloth_test);
Expand Down

0 comments on commit 468d312

Please sign in to comment.