mirror of https://github.com/apache/lucene.git
LUCENE-6271: fix nocommit in TestCodecs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6271@1670421 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
15b0596939
commit
1408332ea9
|
@ -452,21 +452,15 @@ public class TestCodecs extends LuceneTestCase {
|
|||
do {
|
||||
term = field.terms[upto];
|
||||
if (random().nextInt(3) == 1) {
|
||||
final PostingsEnum docs;
|
||||
final PostingsEnum postings;
|
||||
if (!field.omitTF) {
|
||||
// TODO: we should randomize which postings features are available, but
|
||||
// need to coordinate this with the checks below that rely on such features
|
||||
postings = termsEnum.postings(null, null, PostingsEnum.ALL);
|
||||
if (postings != null) {
|
||||
docs = postings;
|
||||
} else {
|
||||
// nocommit: check
|
||||
docs = TestUtil.docs(random(), termsEnum, null, null, PostingsEnum.FREQS);
|
||||
}
|
||||
} else {
|
||||
postings = null;
|
||||
docs = TestUtil.docs(random(), termsEnum, null, null, PostingsEnum.NONE);
|
||||
postings = TestUtil.docs(random(), termsEnum, null, null, PostingsEnum.FREQS);
|
||||
}
|
||||
assertNotNull(docs);
|
||||
assertNotNull(postings);
|
||||
int upto2 = -1;
|
||||
boolean ended = false;
|
||||
while(upto2 < term.docs.length-1) {
|
||||
|
@ -477,10 +471,10 @@ public class TestCodecs extends LuceneTestCase {
|
|||
final int inc = 1+random().nextInt(left-1);
|
||||
upto2 += inc;
|
||||
if (random().nextInt(2) == 1) {
|
||||
doc = docs.advance(term.docs[upto2]);
|
||||
doc = postings.advance(term.docs[upto2]);
|
||||
assertEquals(term.docs[upto2], doc);
|
||||
} else {
|
||||
doc = docs.advance(1+term.docs[upto2]);
|
||||
doc = postings.advance(1+term.docs[upto2]);
|
||||
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
|
||||
// skipped past last doc
|
||||
assert upto2 == term.docs.length-1;
|
||||
|
@ -495,12 +489,13 @@ public class TestCodecs extends LuceneTestCase {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
doc = docs.nextDoc();
|
||||
doc = postings.nextDoc();
|
||||
assertTrue(doc != -1);
|
||||
upto2++;
|
||||
}
|
||||
assertEquals(term.docs[upto2], doc);
|
||||
if (!field.omitTF) {
|
||||
// nocommit: asking for freq() here, but above when field.omitTF == false, PostingsEnum.NONE flag is passed?
|
||||
assertEquals(term.positions[upto2].length, postings.freq());
|
||||
if (random().nextInt(2) == 1) {
|
||||
this.verifyPositions(term.positions[upto2], postings);
|
||||
|
@ -509,7 +504,7 @@ public class TestCodecs extends LuceneTestCase {
|
|||
}
|
||||
|
||||
if (!ended) {
|
||||
assertEquals(DocIdSetIterator.NO_MORE_DOCS, docs.nextDoc());
|
||||
assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings.nextDoc());
|
||||
}
|
||||
}
|
||||
upto++;
|
||||
|
|
Loading…
Reference in New Issue