Apache Lucene open-source search software
LUCENE-2501: make test a bit more random
Michael McCandless08209761d330
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java b/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.javaindex bc89f31c1d2..35c97f3b537 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java@@ -40,24 +40,41 @@ public class TestByteSlices extends LuceneTestCase {counters[stream] = 0;}- int num = atLeast(10000);+ int num = atLeast(3000);for (int iter = 0; iter < num; iter++) {- int stream = random().nextInt(NUM_STREAM);- if (VERBOSE)+ int stream;+ if (random().nextBoolean()) {+ stream = random().nextInt(3);+ } else {+ stream = random().nextInt(NUM_STREAM);+ }++ if (VERBOSE) {System.out.println("write stream=" + stream);+ }if (starts[stream] == -1) {final int spot = pool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);starts[stream] = uptos[stream] = spot + pool.byteOffset;- if (VERBOSE)+ if (VERBOSE) {System.out.println(" init to " + starts[stream]);+ }}writer.init(uptos[stream]);- int numValue = random().nextInt(20);+ int numValue;+ if (random().nextInt(10) == 3) {+ numValue = random().nextInt(100);+ } else if (random().nextInt(5) == 3) {+ numValue = random().nextInt(3);+ } else {+ numValue = random().nextInt(20);+ }+for(int j=0;j<numValue;j++) {- if (VERBOSE)+ if (VERBOSE) {System.out.println(" write " + (counters[stream]+j));+ }// write some large (incl. negative) ints:writer.writeVInt(random().nextInt());writer.writeVInt(counters[stream]+j);