variable length tag descriptions (second thought)

This commit is contained in:
Arndt 2014-05-22 20:26:20 +02:00
parent a145230e0f
commit ba867b4779
20 changed files with 372 additions and 1334 deletions

View file

@ -0,0 +1,28 @@
package btools.util;
import java.util.Random;
import java.util.HashSet;
import org.junit.Assert;
import org.junit.Test;
public class BitCoderContextTest
{
@Test
public void distanceEncodeDecodeTest()
{
byte[] ab = new byte[4000];
BitCoderContext ctx = new BitCoderContext( ab );
for( int i=0; i<1000; i++ )
{
ctx.encodeDistance( i );
}
ctx = new BitCoderContext( ab );
for( int i=0; i<1000; i++ )
{
int value = ctx.decodeDistance();
Assert.assertTrue( "distance value mismatch", value == i );
}
}
}