lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject lucene-solr:branch_7x: LUCENE-8251: Add an explicit test case to cover the discovered failure. But it appears to be already fixed.
Date Fri, 13 Apr 2018 04:34:31 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x e541ed89f -> 21f396276


LUCENE-8251: Add an explicit test case to cover the discovered failure.  But it appears to
be already fixed.


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

Branch: refs/heads/branch_7x
Commit: 21f39627624fe4d2b80ca85fae8fdf2b26fd70b6
Parents: e541ed8
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Fri Apr 13 00:10:57 2018 -0400
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Fri Apr 13 00:34:22 2018 -0400

----------------------------------------------------------------------
 .../apache/lucene/spatial3d/geom/Geo3DUtil.java   |  7 +++++++
 .../lucene/spatial3d/geom/GeoPolygonTest.java     | 18 ++++++++++++++++++
 .../spatial3d/geom/RandomGeoPolygonTest.java      |  2 +-
 3 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/21f39627/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/Geo3DUtil.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/Geo3DUtil.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/Geo3DUtil.java
index add46e4..9a22abd 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/Geo3DUtil.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/Geo3DUtil.java
@@ -40,6 +40,8 @@ class Geo3DUtil {
   final static double RADIANS_PER_METER = 1.0 / PlanetModel.WGS84_MEAN;
   /** How many radians are in one degree */
   final static double RADIANS_PER_DEGREE = Math.PI / 180.0;
+  /** How many degrees in a radian */
+  final static double DEGREES_PER_RADIAN = 180.0 / Math.PI;
   
   private static final double MAX_VALUE = PlanetModel.WGS84.getMaximumMagnitude();
   private static final int BITS = 32;
@@ -113,6 +115,11 @@ class Geo3DUtil {
   static double fromDegrees(final double degrees) {
     return degrees * RADIANS_PER_DEGREE;
   }
+
+  /** Converts radians to degrees */
+  static double toDegrees(final double radians) {
+    return radians * DEGREES_PER_RADIAN;
+  }
   
   /** Converts earth-surface meters to radians */
   static double fromMeters(final double meters) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/21f39627/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
index adff16c..e720cb2 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
@@ -1569,4 +1569,22 @@ shape:
     assertTrue(polygon.isWithin(point) == largePolygon.isWithin(point));
   }
   
+  @Test
+  public void testLUCENE8251() {
+    //POLYGON((135.63207358036593 -51.43541696593334,113.00782694696038 -58.984559858566556,0.0
-3.68E-321,-66.33598777585381 -7.382056816201731,135.63207358036593 -51.43541696593334))
+    final List<GeoPoint> points = new ArrayList<>();
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-51.43541696593334),
Geo3DUtil.fromDegrees(135.63207358036593)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-58.984559858566556),
Geo3DUtil.fromDegrees(113.00782694696038)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-3.68E-321), Geo3DUtil.fromDegrees(0.0)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-7.382056816201731),
Geo3DUtil.fromDegrees(-66.33598777585381)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-51.43541696593334),
Geo3DUtil.fromDegrees(135.63207358036593)));
+    final GeoPolygonFactory.PolygonDescription description = new GeoPolygonFactory.PolygonDescription(points);
+    final GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, description);
+    final GeoPolygon largePolygon = GeoPolygonFactory.makeLargeGeoPolygon(PlanetModel.SPHERE,
Collections.singletonList(description));
+
+    //POINT(0.005183505059185348 1.98E-321)
+    final GeoPoint point = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(1.98E-321),
Geo3DUtil.fromDegrees(0.005183505059185348));
+    assertTrue(polygon.isWithin(point) == largePolygon.isWithin(point));
+  }
+  
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/21f39627/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
index b6364e0..6c5e890 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
@@ -92,7 +92,7 @@ public class RandomGeoPolygonTest extends RandomGeo3dShapeGenerator {
    * biased doubles.
    */
   @Test
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8251")
+  //@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8251")
   @Repeat(iterations = 10)
   public void testComparePolygons() {
     final PlanetModel planetModel = randomPlanetModel();


Mime
View raw message