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 2016/06/10 14:17:50 UTC
lucene-solr:branch_6x: LUCENE-7327: fix rare test bug
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x ef707f05a -> 01dff0680
LUCENE-7327: fix rare test bug
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/01dff068
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/01dff068
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/01dff068
Branch: refs/heads/branch_6x
Commit: 01dff06800ae8730e411bf834a2e67a64a1dcac5
Parents: ef707f0
Author: Mike McCandless <mi...@apache.org>
Authored: Fri Jun 10 10:17:34 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Fri Jun 10 10:17:34 2016 -0400
----------------------------------------------------------------------
.../src/java/org/apache/lucene/spatial3d/Geo3DUtil.java | 4 ++--
.../src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java | 8 +++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/01dff068/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DUtil.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DUtil.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DUtil.java
index b5ce250..6d73210 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DUtil.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DUtil.java
@@ -45,8 +45,8 @@ class Geo3DUtil {
private static final int BITS = 32;
private static final double MUL = (0x1L<<BITS)/(2*MAX_VALUE);
static final double DECODE = getNextSafeDouble(1/MUL);
- private static final int MIN_ENCODED_VALUE = encodeValue(-MAX_VALUE);
- private static final int MAX_ENCODED_VALUE = encodeValue(MAX_VALUE);
+ static final int MIN_ENCODED_VALUE = encodeValue(-MAX_VALUE);
+ static final int MAX_ENCODED_VALUE = encodeValue(MAX_VALUE);
public static int encodeValue(double x) {
if (x > MAX_VALUE) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/01dff068/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
index 69f5999..5cc6e35 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
@@ -1207,13 +1207,19 @@ public class TestGeo3DPoint extends LuceneTestCase {
/**
* step through some integers, ensuring they decode to their expected double values.
- * double values start at -90 and increase by LATITUDE_DECODE for each integer.
+ * double values start at -planetMax and increase by Geo3DUtil.DECODE for each integer.
* check edge cases within the double range and random doubles within the range too.
*/
public void testQuantization() throws Exception {
Random random = random();
for (int i = 0; i < 10000; i++) {
int encoded = random.nextInt();
+ if (encoded < Geo3DUtil.MIN_ENCODED_VALUE) {
+ continue;
+ }
+ if (encoded > Geo3DUtil.MAX_ENCODED_VALUE) {
+ continue;
+ }
double min = encoded * Geo3DUtil.DECODE;
double decoded = Geo3DUtil.decodeValueFloor(encoded);
// should exactly equal expected value