Browse files

test fix

  • Loading branch information...
1 parent d460761 commit 37730d30ba4686e0844dfc5af8687dc8ebd42687 John Wang committed Nov 1, 2011
View
2 src/main/java/com/kamikaze/docidset/api/DocSet.java
@@ -25,7 +25,7 @@
*/
public void addDocs(int[] docids, int start, int len) throws IOException
{
- int i=0;
+ int i=start;
while(i<len)
{
addDoc(docids[i++]);
View
4 src/main/java/com/kamikaze/docidset/impl/ImmutableIntArrayDocIdSet.java
@@ -1,5 +1,7 @@
package com.kamikaze.docidset.impl;
+import java.util.Arrays;
+
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
@@ -53,7 +55,7 @@ public int nextDoc() throws java.io.IOException{
public int advance(int target) throws java.io.IOException{
if (cursor >= _array.length || _array.length == -1) return DocIdSetIterator.NO_MORE_DOCS;
if (target <= _doc) target = _doc + 1;
- int index = IntArray.binarySearch(_array, cursor, _array.length, target);
+ int index = Arrays.binarySearch(_array, target);
if (index > 0){
cursor = index;
_doc = _array[cursor];
View
2 src/main/java/com/kamikaze/docidset/utils/IntArray.java
@@ -77,7 +77,7 @@ protected Object buildArray(int len) {
return new int[len];
}
- public static int binarySearch(int[] a, int fromIndex, int toIndex,int key) {
+ private static int binarySearch(int[] a, int fromIndex, int toIndex,int key) {
int low = fromIndex;
int high = toIndex - 1;
View
4 src/test/java/com/kamikaze/test/PForDeltaTestKamikazeTest.java
@@ -179,7 +179,7 @@ public void testImmutableSet() throws IOException{
dsRegular.addDocs(data, 0, data.length);
DocIdSetIterator dsImmutableIt = dsImmutable.iterator();
DocIdSetIterator dsRegualIt = dsRegular.iterator();
- dsRegualIt.advance(0); // works
- dsImmutableIt.advance(0); // throws exception
+ assertEquals(20, dsRegualIt.advance(0)); // works
+ assertEquals(20, dsImmutableIt.advance(0)); // throws exception
}
}
View
BIN src/test/test-data/SerialDocSet
Binary file not shown.

0 comments on commit 37730d3

Please sign in to comment.