You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2015/05/29 04:07:55 UTC

svn commit: r1682359 - /lucene/dev/branches/lucene6487/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java

Author: dsmiley
Date: Fri May 29 02:07:55 2015
New Revision: 1682359

URL: http://svn.apache.org/r1682359
Log:
LUCENE-6487: Geo3D with WGS84: randomize GeoPointTest lat-lon round-trip

Modified:
    lucene/dev/branches/lucene6487/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java

Modified: lucene/dev/branches/lucene6487/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6487/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java?rev=1682359&r1=1682358&r2=1682359&view=diff
==============================================================================
--- lucene/dev/branches/lucene6487/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java (original)
+++ lucene/dev/branches/lucene6487/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPointTest.java Fri May 29 02:07:55 2015
@@ -17,19 +17,21 @@ package org.apache.lucene.spatial.spatia
  * 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);