From e8b5e3242dff79b8282d37c108612bb0fac486d5 Mon Sep 17 00:00:00 2001 From: David Wayne Smiley Date: Fri, 29 May 2015 02:07:55 +0000 Subject: [PATCH] LUCENE-6487: Geo3D with WGS84: randomize GeoPointTest lat-lon round-trip git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6487@1682359 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/spatial/spatial4j/geo3d/GeoPointTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java b/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java index 71fc9a3fdce..3dbdb2fdfb2 100644 --- a/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java +++ b/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java @@ -17,19 +17,21 @@ package org.apache.lucene.spatial.spatial4j.geo3d; * limitations under the License. */ +import com.spatial4j.core.distance.DistanceUtils; +import org.apache.lucene.util.LuceneTestCase; import org.junit.Test; -import static org.junit.Assert.assertEquals; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomFloat; /** * Test basic GeoPoint functionality. */ -public class GeoPointTest { +public class GeoPointTest extends LuceneTestCase { @Test public void testConversion() { - final double pLat = 0.123; - final double pLon = -0.456; + final double pLat = (randomFloat() * 180.0 - 90.0) * DistanceUtils.DEGREES_TO_RADIANS; + final double pLon = (randomFloat() * 360.0 - 180.0) * DistanceUtils.DEGREES_TO_RADIANS; final GeoPoint p1 = new GeoPoint(PlanetModel.SPHERE, pLat, pLon); assertEquals(pLat, p1.getLatitude(), 1e-12); assertEquals(pLon, p1.getLongitude(), 1e-12);