Apache Lucene open-source search software
minor test cleanups
Robert Muir2b4ab3cbdecd
diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPointDistanceSort.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPointDistanceSort.javaindex 0e5d898e41b..cd38b0ebd9f 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 comparisonsdouble 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()];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.javaindex 10baf42ed39..98867c65eb6 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) {