/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1999-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* *18***********************************************************************/19#include "dttest.h"2021Dtdisc_t Disc =22{ 0, sizeof(long), -1,23newint, NIL(Dtfree_f), compare, hashint,24NIL(Dtmemory_f), NIL(Dtevent_f)25};2627tmain()28{29Dt_t* dt;30long i, k;3132/* testing Dtdeque */33if(!(dt = dtopen(&Disc,Dtdeque)) )34terror("dtopen deque");35if((long)dtinsert(dt,3L) != 3)36terror("Dtdeque insert 3");37if((long)dtappend(dt,4L) != 4)38terror("Dtdeque append 4");39if((long)dtinsert(dt,2L) != 2)40terror("Dtdeque insert 2");41if((long)dtappend(dt,5L) != 5)42terror("Dtdeque append 5");43if((long)dtinsert(dt,1L) != 1)44terror("Dtdeque insert 1");45if((long)dtappend(dt,6L) != 6)46terror("Dtdeque append 6");4748for(k = 1, i = (long)dtfirst(dt); i != 0; i = (long)dtnext(dt,i), k += 1)49if(i != k)50terror("Unmatched elements");51if(k != 7)52terror("Bad element count");5354texit(0);55}565758