You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/06/16 12:08:36 UTC
[06/50] [abbrv] lucene-solr:apiv2: LUCENE-7327: fix rare test bug
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/a923d945
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a923d945
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a923d945
Branch: refs/heads/apiv2
Commit: a923d945b4f6b0874a2ab0a1e5ef538725aa3373
Parents: e418bd0
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:18:01 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/a923d945/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/a923d945/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 85ec548..fed5ada 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