lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1351239 - in /lucene/dev/branches/branch_4x/lucene/core/src: java/org/apache/lucene/util/packed/Packed64SingleBlock.java java/org/apache/lucene/util/packed/PackedInts.java test/org/apache/lucene/util/packed/TestPackedInts.java
Date Mon, 18 Jun 2012 08:45:46 GMT
Author: jpountz
Date: Mon Jun 18 08:45:45 2012
New Revision: 1351239

URL: http://svn.apache.org/viewvc?rev=1351239&view=rev
Log:
LUCENE-4149: Fix test case. (merged from r1351231)

Modified:
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java?rev=1351239&r1=1351238&r2=1351239&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
Mon Jun 18 08:45:45 2012
@@ -140,7 +140,7 @@ abstract class Packed64SingleBlock exten
 
   @Override
   public int get(int index, long[] arr, int off, int len) {
-    assert len > 0;
+    assert len > 0 : "len must be > 0 (got " + len + ")";
     assert index >= 0 && index < valueCount;
     len = Math.min(len, valueCount - index);
     assert off + len <= arr.length;
@@ -192,7 +192,7 @@ abstract class Packed64SingleBlock exten
 
   @Override
   public int set(int index, long[] arr, int off, int len) {
-    assert len > 0;
+    assert len > 0 : "len must be > 0 (got " + len + ")";
     assert index >= 0 && index < valueCount;
     len = Math.min(len, valueCount - index);
     assert off + len <= arr.length;

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java?rev=1351239&r1=1351238&r2=1351239&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
Mon Jun 18 08:45:45 2012
@@ -244,6 +244,7 @@ public class PackedInts {
     }
 
     public int get(int index, long[] arr, int off, int len) {
+      assert len > 0 : "len must be > 0 (got " + len + ")";
       assert index >= 0 && index < valueCount;
       assert off + len <= arr.length;
 
@@ -263,7 +264,7 @@ public class PackedInts {
     }
 
     public int set(int index, long[] arr, int off, int len) {
-      assert len > 0;
+      assert len > 0 : "len must be > 0 (got " + len + ")";
       assert index >= 0 && index < valueCount;
       len = Math.min(len, valueCount - index);
       assert off + len <= arr.length;

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java?rev=1351239&r1=1351238&r2=1351239&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
Mon Jun 18 08:45:45 2012
@@ -445,7 +445,7 @@ public class TestPackedInts extends Luce
   public void testBulkGet() {
     final int valueCount = 1111;
     final int index = random().nextInt(valueCount);
-    final int len = random().nextInt(valueCount * 2);
+    final int len = _TestUtil.nextInt(random(), 1, valueCount * 2);
     final int off = random().nextInt(77);
 
     for (int bpv = 1; bpv <= 64; ++bpv) {
@@ -479,7 +479,7 @@ public class TestPackedInts extends Luce
   public void testBulkSet() {
     final int valueCount = 1111;
     final int index = random().nextInt(valueCount);
-    final int len = random().nextInt(valueCount * 2);
+    final int len = _TestUtil.nextInt(random(), 1, valueCount * 2);
     final int off = random().nextInt(77);
     long[] arr = new long[off+len];
 



Mime
View raw message