4
Copyright (C) 2006 Gabor Csardi <csardi@rmki.kfki.hu>
5
MTA RMKI, Konkoly-Thege Miklos st. 29-33, Budapest 1121, Hungary
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
31
/* igraph_dqueue_init, igraph_dqueue_destroy, igraph_dqueue_empty */
32
igraph_dqueue_init(&q, 5);
33
if (!igraph_dqueue_empty(&q)) {
36
igraph_dqueue_destroy(&q);
38
/* igraph_dqueue_push, igraph_dqueue_pop */
39
igraph_dqueue_init(&q, 4);
40
igraph_dqueue_push(&q, 1);
41
igraph_dqueue_push(&q, 2);
42
igraph_dqueue_push(&q, 3);
43
igraph_dqueue_push(&q, 4);
44
if (igraph_dqueue_pop(&q) != 1) {
47
if (igraph_dqueue_pop(&q) != 2) {
50
if (igraph_dqueue_pop(&q) != 3) {
53
if (igraph_dqueue_pop(&q) != 4) {
56
igraph_dqueue_destroy(&q);
58
/* igraph_dqueue_clear, igraph_dqueue_size */
59
igraph_dqueue_init(&q, 0);
60
if (igraph_dqueue_size(&q) != 0) {
63
igraph_dqueue_clear(&q);
64
if (igraph_dqueue_size(&q) != 0) {
67
for (i=0; i<10; i++) {
68
igraph_dqueue_push(&q, i);
70
igraph_dqueue_clear(&q);
71
if (igraph_dqueue_size(&q) != 0) {
74
igraph_dqueue_destroy(&q);
76
/* TODO: igraph_dqueue_full */
78
/* igraph_dqueue_head, igraph_dqueue_back, igraph_dqueue_pop_back */
79
igraph_dqueue_init(&q, 0);
80
for (i=0; i<10; i++) {
81
igraph_dqueue_push(&q, i);
83
for (i=0; i<10; i++) {
84
if (igraph_dqueue_head(&q) != 0) {
87
if (igraph_dqueue_back(&q) != 9-i) {
90
if (igraph_dqueue_pop_back(&q) != 9-i) {
94
igraph_dqueue_destroy(&q);
96
if (IGRAPH_FINALLY_STACK_SIZE() != 0) return 12;