/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-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* Phong Vo <[email protected]> *17* Glenn Fowler <[email protected]> *18* *19***********************************************************************/20#include "vctest.h"2122int main()23{24char *src, *tar, *del, *t;25Vcdisc_t disc;26Vcodex_t *vc;27ssize_t k, n;2829src = "the big cat and the little cats jump around the big sleeping dog";30tar = "the little dogs and the big dog jump around the sleeping big cat";3132VCDISC(&disc, src, strlen(src), 0);3334if(!(vc = vcopen(&disc, Vcdelta, 0, 0, VC_ENCODE)) )35terror("Cannot open Vcdelta handle");3637if((n = vcapply(vc, tar, strlen(tar), &del)) <= 0)38terror("Vcdelta failed");39if(n >= strlen(tar) )40terror("Did not compress data");4142if(!(vc = vcopen(&disc, Vcdelta, 0, 0, VC_DECODE)) )43terror("Cannot open decoding handle");44if((n = vcapply(vc, del, n, &t)) != strlen(tar) )45terror("Decoding returns wrong size");46for(k = 0; k < n; ++k)47if(t[k] != tar[k])48terror("Decoding failed");4950exit(0);51}525354