adt/gstack_test.c

00001 /* $Id: gstack_test.c 710 2006-07-27 19:02:06Z bruce $ */
00002 #include <stdlib.h>
00003 #include <string.h>
00004 
00005 #include "gstack.h"
00006 
00007 #ifdef SELFTEST_MAIN
00008 #include "selftest.c"
00009 
00010 GSTACK_DECL(test,int);
00011 GSTACK_DEFN(test,int,0,0);
00012 static struct gstack stack;
00013 
00014 MAIN
00015 {
00016   int i;
00017   int* p;
00018   for (i = 0; i < 4; ++i)
00019     debugfn(test_push(&stack, &i));
00020   while ((p = test_top(&stack)) != 0) {
00021     obuf_puti(&outbuf, *p); NL();
00022     test_pop(&stack);
00023   }
00024 }
00025 
00026 #endif
00027 #ifdef SELFTEST_EXP
00028 result=1
00029 result=1
00030 result=1
00031 result=1
00032 3
00033 2
00034 1
00035 0
00036 #endif

Generated on Mon Oct 30 15:11:13 2006 for bglibs by  doxygen 1.4.7