38 lines
731 B
C
38 lines
731 B
C
/*
|
|
* Copyright 2016 (c) Anna Schumaker.
|
|
*/
|
|
#include <gui/queue.h>
|
|
#include <tests/test.h>
|
|
|
|
static void *test_queue_init(struct queue *queue)
|
|
{
|
|
return gui_queue_alloc(queue, "Test Queue");
|
|
}
|
|
|
|
void __test_queue_clear(struct queue *queue, unsigned int n) {}
|
|
|
|
static const struct queue_ops test_ops = {
|
|
.qop_init = test_queue_init,
|
|
.qop_deinit = gui_queue_free,
|
|
.qop_cleared = __test_queue_clear,
|
|
};
|
|
|
|
static void test_queue()
|
|
{
|
|
struct gui_queue *gq;
|
|
struct queue q;
|
|
|
|
queue_init(&q, 0, &test_ops);
|
|
gq = gui_queue(&q);
|
|
|
|
test_not_equal((void *)gq, NULL);
|
|
test_equal((void *)gq->gq_queue, (void *)&q);
|
|
|
|
queue_deinit(&q);
|
|
test_equal((void *)gui_queue(&q), NULL);
|
|
}
|
|
|
|
DECLARE_UNIT_TESTS(
|
|
UNIT_TEST("Queue", test_queue),
|
|
);
|