mirror of https://github.com/apache/lucene.git
LUCENE-2501: make test a bit more random
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1368478 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
175020d4e1
commit
08209761d3
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue