public void testSemiExternalOffsetListGammaCoding() throws IOException {
long[] offsets = { 10, 300, 450, 650, 1000, 1290, 1699 };
LongList listOffsets = new LongArrayList( offsets );
SemiExternalOffsetList list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 1, listOffsets.size() );
for ( int i = 0; i < offsets.length; ++i ) {
assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
}
list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 2, listOffsets.size() );
for ( int i = 0; i < offsets.length; ++i ) {
assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
}
list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 4, listOffsets.size() );
for ( int i = 0; i < offsets.length; ++i ) {
assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
}
list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 7, listOffsets.size() );
for ( int i = 0; i < offsets.length; ++i ) {
assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
}
list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 8, listOffsets.size() );
for ( int i = 0; i < offsets.length; ++i ) {
assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
}
}