mirror of https://github.com/apache/lucene.git
beef up TestDuelingCodecs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5178@1515870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
424369f491
commit
d15e95bd05
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.Analyzer;
|
|||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.NumericDocValuesField;
|
||||
import org.apache.lucene.document.SortedSetDocValuesField;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
@ -134,6 +135,11 @@ public class TestDuelingCodecs extends LuceneTestCase {
|
|||
for (String trash : split) {
|
||||
document.add(new SortedSetDocValuesField("sortedset", new BytesRef(trash)));
|
||||
}
|
||||
// add a numeric dv field sometimes
|
||||
document.removeFields("sparsenumeric");
|
||||
if (random.nextInt(4) == 2) {
|
||||
document.add(new NumericDocValuesField("sparsenumeric", random.nextInt()));
|
||||
}
|
||||
writer.addDocument(document);
|
||||
}
|
||||
|
||||
|
|
|
@ -1972,6 +1972,20 @@ public abstract class LuceneTestCase extends Assert {
|
|||
assertNull(info, rightValues);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Bits leftBits = MultiDocValues.getDocsWithField(leftReader, field);
|
||||
Bits rightBits = MultiDocValues.getDocsWithField(rightReader, field);
|
||||
if (leftBits != null && rightBits != null) {
|
||||
assertEquals(info, leftBits.length(), rightBits.length());
|
||||
for (int i = 0; i < leftBits.length(); i++) {
|
||||
assertEquals(info, leftBits.get(i), rightBits.get(i));
|
||||
}
|
||||
} else {
|
||||
assertNull(info, leftBits);
|
||||
assertNull(info, rightBits);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue