statistical encoding
This commit is contained in:
parent
f8dee5b7d1
commit
ccf6641bad
41 changed files with 4543 additions and 1965 deletions
|
|
@ -0,0 +1,52 @@
|
|||
package btools.codec;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class LinkedListContainerTest
|
||||
{
|
||||
@Test
|
||||
public void linkedListTest1()
|
||||
{
|
||||
int nlists = 553;
|
||||
|
||||
LinkedListContainer llc = new LinkedListContainer( nlists, null );
|
||||
|
||||
for ( int ln = 0; ln < nlists; ln++ )
|
||||
{
|
||||
for ( int i = 0; i < 10; i++ )
|
||||
{
|
||||
llc.addDataElement( ln, ln * i );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < 10; i++ )
|
||||
{
|
||||
for ( int ln = 0; ln < nlists; ln++ )
|
||||
{
|
||||
llc.addDataElement( ln, ln * i );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int ln = 0; ln < nlists; ln++ )
|
||||
{
|
||||
int cnt = llc.initList( ln );
|
||||
Assert.assertTrue( "list size test", cnt == 20 );
|
||||
|
||||
for ( int i = 19; i >= 0; i-- )
|
||||
{
|
||||
int data = llc.getDataElement();
|
||||
Assert.assertTrue( "data value test", data == ln * ( i % 10 ) );
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
llc.getDataElement();
|
||||
Assert.fail( "no more elements expected" );
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue