Skip to content

Commit 12623ac

Browse files
author
deepikabhavnani
committed
Added test case for verification
1 parent 01b2530 commit 12623ac

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

events/equeue/equeue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void equeue_destroy(equeue_t *q)
114114
}
115115
}
116116
if (es->dtor) {
117-
es->dtor(es + 1);
117+
es->dtor(es + 1);
118118
}
119119
}
120120
// notify background timer

events/equeue/tests/tests.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,29 @@ void break_request_cleared_on_timeout(void)
779779
equeue_destroy(&q);
780780
}
781781

782+
void sibling_test(void)
783+
{
784+
equeue_t q;
785+
int err = equeue_create(&q, 1024);
786+
test_assert(!err);
787+
788+
int id0 = equeue_call_in(&q, 1, pass_func, 0);
789+
int id1 = equeue_call_in(&q, 1, pass_func, 0);
790+
int id2 = equeue_call_in(&q, 1, pass_func, 0);
791+
792+
struct equeue_event *e = q.queue;
793+
794+
for (; e; e = e->next) {
795+
for (struct equeue_event *s = e->sibling; s; s = s->sibling) {
796+
test_assert(!s->next);
797+
}
798+
}
799+
equeue_cancel(&q, id0);
800+
equeue_cancel(&q, id1);
801+
equeue_cancel(&q, id2);
802+
equeue_destroy(&q);
803+
}
804+
782805
int main()
783806
{
784807
printf("beginning tests...\n");
@@ -806,7 +829,7 @@ int main()
806829
test_run(fragmenting_barrage_test, 20);
807830
test_run(multithreaded_barrage_test, 20);
808831
test_run(break_request_cleared_on_timeout);
809-
832+
test_run(sibling_test);
810833
printf("done!\n");
811834
return test_failure;
812835
}

0 commit comments

Comments
 (0)