\hypertarget{adt_2gqueue__test_8c-example}{
\section{adt/gqueue\_\-test.c}
}


\begin{DocInclude}\begin{verbatim}1 /* $Id: gqueue_test.c 712 2006-07-27 22:32:39Z bruce $ */
2 #include <stdlib.h>
3 #include <string.h>
4 
5 #include "gqueue.h"
6 
7 #ifdef SELFTEST_MAIN
8 #include "selftest.c"
9 
10 GQUEUE_DECL(test,int);
11 GQUEUE_DEFN(test,int,0,0);
12 static struct gqueue queue;
13 
14 MAIN
15 {
16   int i;
17   int* p;
18   for (i = 0; i < 4; ++i)
19     debugfn(test_push(&queue, &i));
20   while ((p = test_top(&queue)) != 0) {
21     obuf_puti(&outbuf, *p); NL();
22     test_pop(&queue);
23   }
24 }
25 
26 #endif
27 #ifdef SELFTEST_EXP
28 result=1
29 result=1
30 result=1
31 result=1
32 0
33 1
34 2
35 3
36 #endif
\end{verbatim}
\end{DocInclude}
 