mirror of https://github.com/apache/lucene.git
minor test cleanups
This commit is contained in:
parent
f3c743550f
commit
c3ff34e54b
|
@ -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()];
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue