Skip to content

Apache Lucene open-source search software

evil up this test a bit

Michael McCandless9196c5fa9701
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
index 8010e24b7ac..6e2b6750d5a 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
@@ -355,9 +355,12 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
fields.put(field, postings);
Set<String> seenTerms = new HashSet<String>();
- // TODO:
- //final int numTerms = atLeast(10);
- final int numTerms = 4;
+ int numTerms;
+ if (random().nextInt(10) == 7) {
+ numTerms = atLeast(50);
+ } else {
+ numTerms = _TestUtil.nextInt(random(), 2, 20);
+ }
for(int termUpto=0;termUpto<numTerms;termUpto++) {
String term = _TestUtil.randomSimpleString(random());
@@ -597,6 +600,10 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
System.out.println(" verifyEnum: options=" + options + " maxTestOptions=" + maxTestOptions);
}
+ // Make sure TermsEnum really is positioned on the
+ // expected term:
+ assertEquals(term, termsEnum.term());
+
// 50% of the time time pass liveDocs:
boolean useLiveDocs = options.contains(Option.LIVE_DOCS) && random().nextBoolean();
Bits liveDocs;