You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/08/02 16:11:48 UTC

svn commit: r1368479 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java

Author: mikemccand
Date: Thu Aug  2 14:11:48 2012
New Revision: 1368479

URL: http://svn.apache.org/viewvc?rev=1368479&view=rev
Log:
LUCENE-2501: make test a bit more random

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java?rev=1368479&r1=1368478&r2=1368479&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestByteSlices.java Thu Aug  2 14:11:48 2012
@@ -40,24 +40,41 @@ public class TestByteSlices extends Luce
         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);