From: Monty Date: Fri, 7 Jul 2000 01:20:46 +0000 (+0000) Subject: make selftest updates X-Git-Tag: v1.3.3~1188 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b816bfbbc901a2116afa36d833f3a5f06cc4dd33;p=platform%2Fupstream%2Flibvorbis.git make selftest updates svn path=/trunk/vorbis/; revision=514 --- diff --git a/examples/Makefile.in b/examples/Makefile.in index 01d3f7c..5960add 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -1,6 +1,6 @@ # vorbis makefile configured for use with gcc on any platform -# $Id: Makefile.in,v 1.11 2000/06/26 11:25:32 omnic Exp $ +# $Id: Makefile.in,v 1.12 2000/07/07 01:20:46 xiphmont Exp $ ############################################################################### # # @@ -70,6 +70,8 @@ seeking_test: $(OFILES) ../lib/libvorbis.a ../lib/vorbisfile.a ../lib/vorbisfile.a ../lib/libvorbis.a \ -o seeking_test $(LIBS) +selftest: + $(OFILES): $(HFILES) .c.o: diff --git a/lib/codebook.c b/lib/codebook.c index 13bb8a4..03c7095 100644 --- a/lib/codebook.c +++ b/lib/codebook.c @@ -12,7 +12,7 @@ ******************************************************************** function: basic codebook pack/unpack/code/decode operations - last mod: $Id: codebook.c,v 1.15 2000/06/14 01:38:31 xiphmont Exp $ + last mod: $Id: codebook.c,v 1.16 2000/07/07 01:20:46 xiphmont Exp $ ********************************************************************/ @@ -362,9 +362,9 @@ long vorbis_book_decodevs(codebook *book,double *a,oggpack_buffer *b, exactly equal out */ #include + #include "vorbis/book/lsp20_0.vqh" -#include "vorbis/book/lsp32_0.vqh" -#include "vorbis/book/res0_1a.vqh" +#include "vorbis/book/res0a_13.vqh" #define TESTSIZE 40 double test1[TESTSIZE]={ @@ -419,58 +419,6 @@ double test1[TESTSIZE]={ 0.708603, }; -double test2[TESTSIZE]={ - 0.088654, - 0.165742, - 0.279013, - 0.395894, - - 0.110812, - 0.218422, - 0.283423, - 0.371719, - - 0.136985, - 0.186066, - 0.309814, - 0.381521, - - 0.123925, - 0.211707, - 0.314771, - 0.433026, - - 0.088619, - 0.192276, - 0.277568, - 0.343509, - - 0.068400, - 0.132901, - 0.223999, - 0.302538, - - 0.202159, - 0.306131, - 0.360362, - 0.416066, - - 0.072591, - 0.178019, - 0.304315, - 0.376516, - - 0.094336, - 0.188401, - 0.325119, - 0.390264, - - 0.091636, - 0.223099, - 0.282899, - 0.375124, -}; - double test3[TESTSIZE]={ 0,1,-2,3,4,-5,6,7,8,9, 8,-2,7,-1,4,6,8,3,1,-9, @@ -478,9 +426,8 @@ double test3[TESTSIZE]={ 30,-25,-30,-1,-5,-32,4,3,-2,0}; static_codebook *testlist[]={&_vq_book_lsp20_0, - &_vq_book_lsp32_0, - &_vq_book_res0_1a,NULL}; -double *testvec[]={test1,test2,test3}; + &_vq_book_res0a_13,NULL}; +double *testvec[]={test1,test3}; int main(){ oggpack_buffer write; @@ -506,8 +453,10 @@ int main(){ we can write */ vorbis_staticbook_pack(testlist[ptr],&write); fprintf(stderr,"Codebook size %ld bytes... ",_oggpack_bytes(&write)); - for(i=0;ipacketno!=sequence){ - fprintf(stderr,"incorrect packet sequence %ld != %d\n",op->packetno,sequence); + fprintf(stderr,"incorrect packet sequence %ld != %d\n", + (long)(op->packetno),sequence); exit(1); } @@ -802,7 +803,7 @@ void checkpacket(ogg_packet *op,int len, int no, int pos){ } } -void check_page(unsigned char *data,int *header,ogg_page *og){ +void check_page(unsigned char *data,const int *header,ogg_page *og){ long j; /* Test data */ for(j=0;jbody_len;j++) @@ -869,7 +870,7 @@ void error(void){ exit(1); } -void test_pack(int *pl, int **headers){ +void test_pack(const int *pl, const int **headers){ unsigned char *data=malloc(1024*1024); /* for scripted test cases only */ long inptr=0; long outptr=0; @@ -1021,14 +1022,14 @@ int main(void){ { /* 17 only */ - int packets[]={17, -1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x06, + const int packets[]={17, -1}; + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x06, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x15,0xed,0xec,0x91, 1, 17}; - int *headret[]={head1,NULL}; + const int *headret[]={head1,NULL}; fprintf(stderr,"testing single page encoding... "); test_pack(packets,headret); @@ -1036,21 +1037,21 @@ int main(void){ { /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ - int packets[]={17, 254, 255, 256, 500, 510, 600, -1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, + const int packets[]={17, 254, 255, 256, 500, 510, 600, -1}; + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x59,0x10,0x6c,0x2c, 1, 17}; - int head2[] = {0x4f,0x67,0x67,0x53,0,0x04, + const int head2[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x89,0x33,0x85,0xce, 13, 254,255,0,255,1,255,245,255,255,0, 255,255,90}; - int *headret[]={head1,head2,NULL}; + const int *headret[]={head1,head2,NULL}; fprintf(stderr,"testing basic page encoding... "); test_pack(packets,headret); @@ -1058,22 +1059,22 @@ int main(void){ { /* nil packets; beginning,middle,end */ - int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1}; + const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; - int head2[] = {0x4f,0x67,0x67,0x53,0,0x04, + const int head2[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x5c,0x3f,0x66,0xcb, 17, 17,254,255,0,0,255,1,0,255,245,255,255,0, 255,255,90,0}; - int *headret[]={head1,head2,NULL}; + const int *headret[]={head1,head2,NULL}; fprintf(stderr,"testing basic nil packets... "); test_pack(packets,headret); @@ -1081,9 +1082,9 @@ int main(void){ { /* large initial packet */ - int packets[]={4345,259,255,-1}; + const int packets[]={4345,259,255,-1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x01,0x27,0x31,0xaa, @@ -1091,13 +1092,13 @@ int main(void){ 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,10}; - int head2[] = {0x4f,0x67,0x67,0x53,0,0x04, + const int head2[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x7f,0x4e,0x8a,0xd2, 4, 255,4,255,0}; - int *headret[]={head1,head2,NULL}; + const int *headret[]={head1,head2,NULL}; fprintf(stderr,"testing initial-packet lacing > 4k... "); test_pack(packets,headret); @@ -1105,16 +1106,16 @@ int main(void){ { /* continuing packet test */ - int packets[]={0,4345,259,255,-1}; + const int packets[]={0,4345,259,255,-1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; - int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, + const int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x34,0x24,0xd5,0x29, @@ -1122,13 +1123,13 @@ int main(void){ 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255}; - int head3[] = {0x4f,0x67,0x67,0x53,0,0x05, + const int head3[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xc8,0xc3,0xcb,0xed, 5, 10,255,4,255,0}; - int *headret[]={head1,head2,head3,NULL}; + const int *headret[]={head1,head2,head3,NULL}; fprintf(stderr,"testing single packet page span... "); test_pack(packets,headret); @@ -1137,7 +1138,7 @@ int main(void){ /* page with the 255 segment limit */ { - int packets[]={0,10,10,10,10,10,10,10,10, + const int packets[]={0,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, @@ -1170,14 +1171,14 @@ int main(void){ 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,50,-1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; - int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, + const int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0xed,0x2a,0x2e,0xa7, @@ -1215,13 +1216,13 @@ int main(void){ 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10}; - int head3[] = {0x4f,0x67,0x67,0x53,0,0x04, + const int head3[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0x6c,0x3b,0x82,0x3d, 1, 50}; - int *headret[]={head1,head2,head3,NULL}; + const int *headret[]={head1,head2,head3,NULL}; fprintf(stderr,"testing max packet segments... "); test_pack(packets,headret); @@ -1230,16 +1231,16 @@ int main(void){ { /* packet that overspans over an entire page */ - int packets[]={0,100,9000,259,255,-1}; + const int packets[]={0,100,9000,259,255,-1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; - int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, + const int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x3c,0xd9,0x4d,0x3f, @@ -1247,7 +1248,7 @@ int main(void){ 100,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255}; - int head3[] = {0x4f,0x67,0x67,0x53,0,0x01, + const int head3[] = {0x4f,0x67,0x67,0x53,0,0x01, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xbd,0xd5,0xb5,0x8b, @@ -1255,13 +1256,13 @@ int main(void){ 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255}; - int head4[] = {0x4f,0x67,0x67,0x53,0,0x05, + const int head4[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,3,0,0,0, 0xef,0xdd,0x88,0xde, 7, 255,255,75,255,4,255,0}; - int *headret[]={head1,head2,head3,head4,NULL}; + const int *headret[]={head1,head2,head3,head4,NULL}; fprintf(stderr,"testing very large packets... "); test_pack(packets,headret); @@ -1270,16 +1271,16 @@ int main(void){ { /* term only page. why not? */ - int packets[]={0,100,4080,-1}; + const int packets[]={0,100,4080,-1}; - int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, + const int head1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; - int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, + const int head2[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x3c,0xd9,0x4d,0x3f, @@ -1287,13 +1288,13 @@ int main(void){ 100,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255}; - int head3[] = {0x4f,0x67,0x67,0x53,0,0x05, + const int head3[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xd4,0xe0,0x60,0xe5, 1,0}; - int *headret[]={head1,head2,head3,NULL}; + const int *headret[]={head1,head2,head3,NULL}; fprintf(stderr,"testing zero data page (1 nil packet)... "); test_pack(packets,headret);