Permalink
Browse files

beefed up test and fixed another bug

  • Loading branch information...
1 parent 6718f1c commit 78d80fdef317bd266f4b3afeffeb7bc096b92091 John Wang committed Nov 2, 2011
@@ -63,7 +63,7 @@ public int advance(int target) throws java.io.IOException{
}
else{
cursor = -(index+1);
- if (cursor>_array.length) {
+ if (cursor>=_array.length) {
_doc = DocIdSetIterator.NO_MORE_DOCS;
}
else {
@@ -179,7 +179,11 @@ public void testImmutableSet() throws IOException{
dsRegular.addDocs(data, 0, data.length);
DocIdSetIterator dsImmutableIt = dsImmutable.iterator();
DocIdSetIterator dsRegualIt = dsRegular.iterator();
- assertEquals(20, dsRegualIt.advance(0)); // works
- assertEquals(20, dsImmutableIt.advance(0)); // throws exception
+ assertEquals(20, dsRegualIt.advance(0));
+ assertEquals(20, dsImmutableIt.advance(0));
+ assertEquals(30, dsRegualIt.advance(29));
+ assertEquals(30, dsImmutableIt.advance(29));
+ assertEquals(DocIdSetIterator.NO_MORE_DOCS,dsRegualIt.advance(50));
+ assertEquals(DocIdSetIterator.NO_MORE_DOCS,dsImmutableIt.advance(50));
}
}

0 comments on commit 78d80fd

Please sign in to comment.