Add tests for queue teardown
This commit is contained in:
		
							parent
							
								
									e04003e291
								
							
						
					
					
						commit
						fb5926b6fa
					
				@ -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: */
 | 
				
			||||||
 | 
				
			|||||||
@ -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: */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user