Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTimothy B. Terriberry <tterribe@xiph.org>2008-12-21 06:12:18 +0300
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2008-12-21 07:19:56 +0300
commit0268a996769388528ba7bf34da15b4e6c530f891 (patch)
treee6e9b28522631304b8de966364bbd9b95f43b4a0 /tests
parent763abd0475340f03014559e662ac51b7350b3fb0 (diff)
Fix ectest to not check a case which isn't guaranteed to work, and which we don't use.
When I removed the special case for EC_ILOG(0) in commit 06390d082dcdfa8addb3dde337543bc0f0ebae44, it broke ec_dec_uint() with _ft=1 (which should encode the value 0 using 0 bits). This feature was tested by ectest.c, but not actually used by libcelt. An assert has been added to ec_dec_uint() to ensure that we don't try to use this feature by accident. ec_enc_uint() was actually correct, but support for this feature has been removed and the assert put in its place.
Diffstat (limited to 'tests')
-rw-r--r--tests/ectest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/ectest.c b/tests/ectest.c
index b3fc220..49d39a1 100644
--- a/tests/ectest.c
+++ b/tests/ectest.c
@@ -31,7 +31,7 @@ int main(int _argc,char **_argv){
/*Testing encoding of raw bit values.*/
ec_byte_writeinit(&buf);
ec_enc_init(&enc,&buf);
- for(ft=0;ft<1024;ft++){
+ for(ft=2;ft<1024;ft++){
for(i=0;i<ft;i++){
entropy+=log(ft)*M_LOG2E;
ec_enc_uint(&enc,i,ft);
@@ -59,7 +59,7 @@ int main(int _argc,char **_argv){
fprintf(stderr,"Packed to %li bytes.\n",(long)(buf.ptr-buf.buf));
ec_byte_readinit(&buf,ec_byte_get_buffer(&buf),ec_byte_bytes(&buf));
ec_dec_init(&dec,&buf);
- for(ft=0;ft<1024;ft++){
+ for(ft=2;ft<1024;ft++){
for(i=0;i<ft;i++){
sym=ec_dec_uint(&dec,ft);
if(sym!=i){