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 2010/06/17 12:54:24 UTC

svn commit: r955547 - /lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestByteSlices.java

Author: mikemccand
Date: Thu Jun 17 10:54:23 2010
New Revision: 955547

URL: http://svn.apache.org/viewvc?rev=955547&view=rev
Log:
LUCENE-2501: strengthen this testcase a bit, but I still can't get it to fail

Modified:
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestByteSlices.java

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestByteSlices.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestByteSlices.java?rev=955547&r1=955546&r2=955547&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestByteSlices.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestByteSlices.java Thu Jun 17 10:54:23 2010
@@ -55,7 +55,7 @@ public class TestByteSlices extends Luce
   public void testBasic() throws Throwable {
     ByteBlockPool pool = new ByteBlockPool(new ByteBlockAllocator());
 
-    final int NUM_STREAM = 25;
+    final int NUM_STREAM = 100*_TestUtil.getRandomMultiplier();
 
     ByteSliceWriter writer = new ByteSliceWriter(pool);
 
@@ -91,8 +91,9 @@ public class TestByteSlices extends Luce
         for(int j=0;j<numValue;j++) {
           if (VERBOSE)
             System.out.println("    write " + (counters[stream]+j));
+          // write some large (incl. negative) ints:
+          writer.writeVInt(r.nextInt());
           writer.writeVInt(counters[stream]+j);
-          //writer.writeVInt(ti);
         }
         counters[stream] += numValue;
         uptos[stream] = writer.getAddress();
@@ -104,11 +105,12 @@ public class TestByteSlices extends Luce
         if (VERBOSE)
           System.out.println("  stream=" + stream + " count=" + counters[stream]);
 
-        if (starts[stream] != uptos[stream]) {
+        if (starts[stream] != -1 && starts[stream] != uptos[stream]) {
           reader.init(pool, starts[stream], uptos[stream]);
-          for(int j=0;j<counters[stream];j++) 
-            assertEquals(j, reader.readVInt());
-            //assertEquals(ti, reader.readVInt());
+          for(int j=0;j<counters[stream];j++) {
+            reader.readVInt();
+            assertEquals(j, reader.readVInt()); 
+          }
         }
       }