/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Phong Vo <kpv@research.att.com> *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "vctest.h"
{
155, 18, 15, 4, 2, 2, 0, 3, 14, 5, 3, 4, 17, 1, 0, 3,
136, 2, 5, 5, 5, 1, 2, 3, 11, 2, 4, 2, 14, 13, 12, 13,
12, 9, 7, 1, 17, 4, 0, 4, 16, 1, 2, 4, 9, 2, 2, 2,
20, 1, 0, 1, 4, 2, 2, 3, 7, 5, 0, 0, 4, 4, 2, 1,
7, 1, 7, 2, 9, 7, 11, 8, 23, 3, 3, 1, 5, 2, 2, 4,
13, 0, 0, 1, 21, 1, 1, 2, 9, 1, 0, 0, 3, 2, 1, 3,
9, 0, 1, 6, 7, 0, 3, 0, 3, 1, 0, 2, 13, 0, 2, 0,
6, 1, 1, 5, 1, 0, 0, 0, 3, 0, 2, 0, 1, 2, 1, 2,
10, 4, 0, 1, 2, 0, 1, 2, 7, 2, 0, 0, 3, 1, 3, 1,
10, 2, 0, 2, 3, 2, 3, 4, 3, 0, 2, 3, 18, 3, 3, 1,
5, 4, 3, 5, 7, 8, 6, 2, 3, 4, 0, 3, 16, 0, 6, 2,
16, 4, 2, 1, 4, 2, 0, 4, 14, 3, 0, 0, 1, 0, 1, 0,
5, 1, 1, 4, 5, 1, 2, 2, 9, 1, 1, 1, 9, 1, 1, 0,
7, 1, 2, 0, 12, 1, 1, 1, 14, 0, 1, 1, 2, 3, 2, 5,
7, 1, 10, 1, 4, 0, 1, 3, 3, 0, 2, 2, 4, 2, 1, 2,
10, 0, 0, 1, 4, 0, 2, 0, 6, 1, 0, 1, 2, 0, 0, 10
};
int main()
{
terror("Cannot open Vchuff handle");
terror("Cannot open Vchuff handle to decode");
/* test a few boundary cases */
tar = "000000000000000011111122222abc012000000111111222222012abc";
terror("Vchuff failed0");
terror("Vchuff failed0 decoding");
terror("Vchuff failed1");
terror("Vchuff failed1 decoding");
if(t[0] != tar[0])
terror("Bad byte");
terror("Vchuff failed2");
terror("Vchuff failed2 decoding");
for(k = 0; k < 16; ++k)
if(t[k] != tar[k])
terror("Bad byte");
/* test the original learning algorithm */
terror("Vchuff failed");
terror("Vchuff returns wrong size");
for(k = 0; k < n; ++k)
if(t[k] != tar[k])
terror("Vchuff computed bad byte");
/* generate a large array of data using the frequency profile */
b = buf;
for(k = 0; k < 256; ++k)
{ for(n = 0; n < Freq[k]; ++n)
*b++ = k;
}
terror("Vchuff failed8");
terror("Vchuff failed8 decoding");
for(k = 0; k < b-buf; ++k)
if(t[k] != buf[k])
terror("Bad byte8");
/* test grouping method */
while(b < endb)
{ for(k = 0; k < 256 && b < endb; ++k)
*b++ = k;
}
}
terror("Cannot open Vchuffgroup handle");
terror("Cannot open Vchuffgroup handle decoding ");
terror("Vchuffgroup failed");
terror("Vchuffgroup failed decoding");
for(k = 0; k < b-buf; ++k)
if(t[k] != buf[k])
terror("Bad byte");
/* test partitioning method */
terror("Cannot open Vchuffpart handle");
terror("Cannot open Vchuffpart handle decoding");
terror("Vchuffpart failed");
terror("Vchuffpart failed decoding");
for(k = 0; k < b-buf; ++k)
if(t[k] != buf[k])
terror("Bad byte");
exit(0);
}