You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2016/03/28 17:59:12 UTC

lucene-solr:branch_6x: minor test cleanups

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x f3c743550 -> c3ff34e54


minor test cleanups


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c3ff34e5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c3ff34e5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c3ff34e5

Branch: refs/heads/branch_6x
Commit: c3ff34e54bb5add4a1346ca484e9fcda90f7f999
Parents: f3c7435
Author: Robert Muir <rm...@apache.org>
Authored: Mon Mar 28 12:00:53 2016 -0400
Committer: Robert Muir <rm...@apache.org>
Committed: Mon Mar 28 12:01:20 2016 -0400

----------------------------------------------------------------------
 .../document/TestLatLonPointDistanceSort.java    |  9 +++++----
 .../apache/lucene/spatial/util/TestGeoUtils.java | 19 -------------------
 2 files changed, 5 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c3ff34e5/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPointDistanceSort.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPointDistanceSort.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPointDistanceSort.java
index 0e5d898..cd38b0e 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPointDistanceSort.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPointDistanceSort.java
@@ -27,6 +27,7 @@ import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.spatial.util.GeoTestUtil;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.SloppyMath;
@@ -182,8 +183,8 @@ public class TestLatLonPointDistanceSort extends LuceneTestCase {
       doc.add(new StoredField("id", i));
       doc.add(new NumericDocValuesField("id", i));
       if (random().nextInt(10) > 7) {
-        double latRaw = -90 + 180.0 * random().nextDouble();
-        double lonRaw = -180 + 360.0 * random().nextDouble();
+        double latRaw = GeoTestUtil.nextLatitude();
+        double lonRaw = GeoTestUtil.nextLongitude();
         // pre-normalize up front, so we can just use quantized value for testing and do simple exact comparisons
         double lat = LatLonPoint.decodeLatitude(LatLonPoint.encodeLatitude(latRaw));
         double lon = LatLonPoint.decodeLongitude(LatLonPoint.encodeLongitude(lonRaw));
@@ -198,8 +199,8 @@ public class TestLatLonPointDistanceSort extends LuceneTestCase {
     IndexSearcher searcher = newSearcher(reader);
 
     for (int i = 0; i < numQueries; i++) {
-      double lat = -90 + 180.0 * random().nextDouble();
-      double lon = -180 + 360.0 * random().nextDouble();
+      double lat = GeoTestUtil.nextLatitude();
+      double lon = GeoTestUtil.nextLongitude();
       double missingValue = Double.POSITIVE_INFINITY;
 
       Result expected[] = new Result[reader.maxDoc()];

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c3ff34e5/lucene/spatial/src/test/org/apache/lucene/spatial/util/TestGeoUtils.java
----------------------------------------------------------------------
diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/util/TestGeoUtils.java b/lucene/spatial/src/test/org/apache/lucene/spatial/util/TestGeoUtils.java
index 10baf42..98867c6 100644
--- a/lucene/spatial/src/test/org/apache/lucene/spatial/util/TestGeoUtils.java
+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/util/TestGeoUtils.java
@@ -28,9 +28,6 @@ import org.junit.BeforeClass;
  */
 public class TestGeoUtils extends LuceneTestCase {
 
-  private static final double LON_SCALE = (0x1L<<GeoEncodingUtils.BITS)/360.0D;
-  private static final double LAT_SCALE = (0x1L<<GeoEncodingUtils.BITS)/180.0D;
-
   // Global bounding box we will "cover" in the random test; we have to make this "smallish" else the queries take very long:
   private static double originLat;
   private static double originLon;
@@ -41,22 +38,6 @@ public class TestGeoUtils extends LuceneTestCase {
     originLat = GeoTestUtil.nextLatitude();
   }
 
-  public long scaleLon(final double val) {
-    return (long) ((val-GeoUtils.MIN_LON_INCL) * LON_SCALE);
-  }
-
-  public long scaleLat(final double val) {
-    return (long) ((val-GeoUtils.MIN_LAT_INCL) * LAT_SCALE);
-  }
-
-  public double unscaleLon(final long val) {
-    return (val / LON_SCALE) + GeoUtils.MIN_LON_INCL;
-  }
-
-  public double unscaleLat(final long val) {
-    return (val / LAT_SCALE) + GeoUtils.MIN_LAT_INCL;
-  }
-
   public double randomLat(boolean small) {
     double result;
     if (small) {