1.0 preparations

This commit is contained in:
Arndt 2014-06-19 09:15:51 +02:00
parent 55717c6e71
commit 8fa82633d4
34 changed files with 742 additions and 462 deletions

View file

@ -9,19 +9,19 @@ import org.junit.Test;
public class BitCoderContextTest
{
@Test
public void distanceEncodeDecodeTest()
public void varBitsEncodeDecodeTest()
{
byte[] ab = new byte[4000];
BitCoderContext ctx = new BitCoderContext( ab );
for( int i=0; i<1000; i++ )
{
ctx.encodeDistance( i );
ctx.encodeVarBits( i );
}
ctx = new BitCoderContext( ab );
for( int i=0; i<1000; i++ )
{
int value = ctx.decodeDistance();
int value = ctx.decodeVarBits();
Assert.assertTrue( "distance value mismatch", value == i );
}
}

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 ByteDataIOTest
{
@Test
public void varLengthEncodeDecodeTest()
{
byte[] ab = new byte[4000];
ByteDataWriter w = new ByteDataWriter( ab );
for( int i=0; i<1000; i++ )
{
w.writeVarLengthUnsigned( i );
}
ByteDataReader r = new ByteDataReader( ab );
for( int i=0; i<1000; i++ )
{
int value = r.readVarLengthUnsigned();
Assert.assertTrue( "value mismatch", value == i );
}
}
}