Package it.unimi.dsi.mg4j.search

Source Code of it.unimi.dsi.mg4j.search.BitStreamIndexReaderTest

package it.unimi.dsi.mg4j.search;

import it.unimi.dsi.mg4j.index.DiskBasedIndex;
import it.unimi.dsi.mg4j.index.Index;
import it.unimi.dsi.mg4j.index.IndexIterator;
import it.unimi.dsi.mg4j.tool.IndexBuilder;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;

import junit.framework.TestCase;

import org.apache.commons.configuration.ConfigurationException;

import it.unimi.dsi.mg4j.document.StringArrayDocumentCollection;

public class BitStreamIndexReaderTest extends TestCase {

  public void testSkipToEndOfList() throws ConfigurationException, SecurityException, IOException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    String basename = File.createTempFile( getClass().getSimpleName(), "test" ).getCanonicalPath();
    new IndexBuilder( basename, new StringArrayDocumentCollection( new String[] { "a", "a", "c" } ) ).run();

    Index index = DiskBasedIndex.getInstance( basename + "-text", true, true );
    IndexIterator indexIterator = index.documents( "a" );
    assertEquals( Integer.MAX_VALUE, indexIterator.skipTo( Integer.MAX_VALUE ) );
    indexIterator.dispose();

    indexIterator = index.documents( "a" );
    assertEquals( 0, indexIterator.skipTo( 0 ) );
    assertEquals( 1, indexIterator.skipTo( 1 ) );
    assertEquals( Integer.MAX_VALUE, indexIterator.skipTo( 2 ) );
    indexIterator.dispose();
}
}
TOP

Related Classes of it.unimi.dsi.mg4j.search.BitStreamIndexReaderTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.