Add tests for queue teardown

This commit is contained in:
Benedikt Heine 2018-10-01 22:03:38 +02:00
parent e04003e291
commit fb5926b6fa
2 changed files with 21 additions and 0 deletions

View File

@ -538,7 +538,10 @@ static void teardown_notification(gpointer data)
void queues_teardown(void) void queues_teardown(void)
{ {
g_queue_free_full(history, teardown_notification); g_queue_free_full(history, teardown_notification);
history = NULL;
g_queue_free_full(displayed, teardown_notification); g_queue_free_full(displayed, teardown_notification);
displayed = NULL;
g_queue_free_full(waiting, teardown_notification); g_queue_free_full(waiting, teardown_notification);
waiting = NULL;
} }
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */

View File

@ -12,9 +12,27 @@ TEST test_queue_init(void)
PASS(); PASS();
} }
TEST test_queue_teardown(void)
{
queues_init();
QUEUE_LEN_ALL(0, 0, 0);
struct notification *n = test_notification("n", -1);
queues_notification_insert(n);
queues_teardown();
ASSERT(waiting == NULL);
ASSERT(displayed == NULL);
ASSERT(history == NULL);
PASS();
}
SUITE(suite_queues) SUITE(suite_queues)
{ {
RUN_TEST(test_queue_init); RUN_TEST(test_queue_init);
RUN_TEST(test_queue_teardown);
} }
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */