blob: 37338ec93d26bc47b71bc18f3e5dea4bb26c29f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.predicate.index;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:magnarn@yahoo-inc.com">Magnar Nedland</a>
*/
public class ZeroConstraintPostingListTest {
@Test
public void requireThatPostingListCanIterate() {
ZeroConstraintPostingList postingList =
new ZeroConstraintPostingList(new int[] {2, 4, 6, 8});
assertEquals(-1, postingList.getDocId());
assertEquals(Interval.fromBoundaries(1, Interval.ZERO_CONSTRAINT_RANGE), postingList.getInterval());
assertEquals(0xffffffffffffffffL, postingList.getSubquery());
assertTrue(postingList.nextDocument(0));
assertEquals(2, postingList.getDocId());
assertTrue(postingList.prepareIntervals());
assertFalse(postingList.nextInterval());
assertTrue(postingList.nextDocument(7));
assertEquals(8, postingList.getDocId());
assertTrue(postingList.nextDocument(7));
assertEquals(8, postingList.getDocId());
assertFalse(postingList.nextDocument(8));
}
}
|