12 g_assert (g_queue_empty (q) == TRUE);
14 g_queue_push (q, GINT_TO_POINTER (1));
15 g_assert (g_list_length (q->list) == 1);
16 g_queue_push (q, GINT_TO_POINTER (2));
17 g_assert (g_list_length (q->list) == 2);
18 g_queue_push (q, GINT_TO_POINTER (3));
19 g_assert (g_list_length (q->list) == 3);
20 g_queue_push (q, GINT_TO_POINTER (4));
21 g_assert (g_list_length (q->list) == 4);
22 g_queue_push (q, GINT_TO_POINTER (5));
23 g_assert (g_list_length (q->list) == 5);
25 g_assert (g_queue_empty (q) == FALSE);
27 g_assert (g_queue_index (q, GINT_TO_POINTER (2)) == 1);
28 g_assert (g_queue_index (q, GINT_TO_POINTER (142)) == -1);
30 g_assert (g_queue_peek (q) == GINT_TO_POINTER (1));
31 g_assert (g_queue_peek_front (q) == GINT_TO_POINTER (1));
32 g_assert (g_queue_peek_back (q) == GINT_TO_POINTER (5));
34 g_assert (g_queue_pop (q) == GINT_TO_POINTER (1));
35 g_assert (g_list_length (q->list) == 4);
36 g_assert (g_queue_pop (q) == GINT_TO_POINTER (2));
37 g_assert (g_list_length (q->list) == 3);
38 g_assert (g_queue_pop (q) == GINT_TO_POINTER (3));
39 g_assert (g_list_length (q->list) == 2);
40 g_assert (g_queue_pop (q) == GINT_TO_POINTER (4));
41 g_assert (g_list_length (q->list) == 1);
42 g_assert (g_queue_pop (q) == GINT_TO_POINTER (5));
43 g_assert (g_list_length (q->list) == 0);
44 g_assert (g_queue_pop (q) == NULL);
45 g_assert (g_list_length (q->list) == 0);
46 g_assert (g_queue_pop (q) == NULL);
47 g_assert (g_list_length (q->list) == 0);
49 g_assert (g_queue_empty (q) == TRUE);
51 /************************/
53 g_queue_push_front (q, GINT_TO_POINTER (1));
54 g_assert (g_list_length (q->list) == 1);
55 g_queue_push_front (q, GINT_TO_POINTER (2));
56 g_assert (g_list_length (q->list) == 2);
57 g_queue_push_front (q, GINT_TO_POINTER (3));
58 g_assert (g_list_length (q->list) == 3);
59 g_queue_push_front (q, GINT_TO_POINTER (4));
60 g_assert (g_list_length (q->list) == 4);
61 g_queue_push_front (q, GINT_TO_POINTER (5));
62 g_assert (g_list_length (q->list) == 5);
64 g_assert (g_queue_pop_front (q) == GINT_TO_POINTER (5));
65 g_assert (g_list_length (q->list) == 4);
66 g_assert (g_queue_pop_front (q) == GINT_TO_POINTER (4));
67 g_assert (g_list_length (q->list) == 3);
68 g_assert (g_queue_pop_front (q) == GINT_TO_POINTER (3));
69 g_assert (g_list_length (q->list) == 2);
70 g_assert (g_queue_pop_front (q) == GINT_TO_POINTER (2));
71 g_assert (g_list_length (q->list) == 1);
72 g_assert (g_queue_pop_front (q) == GINT_TO_POINTER (1));
73 g_assert (g_list_length (q->list) == 0);
74 g_assert (g_queue_pop_front (q) == NULL);
75 g_assert (g_list_length (q->list) == 0);
76 g_assert (g_queue_pop_front (q) == NULL);
77 g_assert (g_list_length (q->list) == 0);