use of org.apache.cassandra.io.sstable.IndexHelper.IndexInfo in project eiger by wlloyd.
the class IndexHelperTest method testIndexHelper.
@Test
public void testIndexHelper() {
List<IndexInfo> indexes = new ArrayList<IndexInfo>();
indexes.add(new IndexInfo(bytes(0L), bytes(5L), 0, 0));
indexes.add(new IndexInfo(bytes(10L), bytes(15L), 0, 0));
indexes.add(new IndexInfo(bytes(20L), bytes(25L), 0, 0));
AbstractType comp = IntegerType.instance;
assert 0 == IndexHelper.indexFor(bytes(-1L), indexes, comp, false);
assert 0 == IndexHelper.indexFor(bytes(5L), indexes, comp, false);
assert 1 == IndexHelper.indexFor(bytes(12L), indexes, comp, false);
assert 2 == IndexHelper.indexFor(bytes(17L), indexes, comp, false);
assert 3 == IndexHelper.indexFor(bytes(100L), indexes, comp, false);
assert -1 == IndexHelper.indexFor(bytes(-1L), indexes, comp, true);
assert 0 == IndexHelper.indexFor(bytes(5L), indexes, comp, true);
assert 1 == IndexHelper.indexFor(bytes(12L), indexes, comp, true);
assert 1 == IndexHelper.indexFor(bytes(17L), indexes, comp, true);
assert 2 == IndexHelper.indexFor(bytes(100L), indexes, comp, true);
}
Aggregations