From 7191907c0ab0b8f489cef21435483963a168eaad Mon Sep 17 00:00:00 2001 From: --replace-all Date: Sun, 3 Mar 2024 16:47:58 +0100 Subject: [PATCH] Fix: lat and lon were inverted in test for toGeohash --- .../com/esri/core/geometry/TestGeohash.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/esri/core/geometry/TestGeohash.java b/src/test/java/com/esri/core/geometry/TestGeohash.java index fda60352..fa423468 100644 --- a/src/test/java/com/esri/core/geometry/TestGeohash.java +++ b/src/test/java/com/esri/core/geometry/TestGeohash.java @@ -98,9 +98,9 @@ public void testConvertToBinary() { @Test public void testToGeoHash() { - Point2D p1 = new Point2D(48.669, -4.329); - Point2D p2 = new Point2D(70.273, -30.382); - Point2D p3 = new Point2D(37.691, 14.276); + Point2D p1 = new Point2D(-4.329,48.669); + Point2D p2 = new Point2D(-30.382, 70.273); + Point2D p3 = new Point2D(14.276, 37.691); int chrLen = 5; @@ -127,4 +127,22 @@ public void testToGeohash2(){ assertEquals(expected, geoHash); } + @Test + public void testContainingGeohashWithHugeValues(){ + Envelope2D envelope = new Envelope2D(-179, -89, 179, 89); + assertEquals("", Geohash.containingGeohash(envelope)); + } + + @Test + public void testContainingGeohash(){ + Envelope2D envelope = new Envelope2D(-179, -89, -140, -50); + assertEquals("0", Geohash.containingGeohash(envelope)); + } + + @Test + public void testContainingGeohash2(){ + Envelope2D envelope = new Envelope2D(18.078, 59.3564, 18.1,59.3344); + assertEquals("u6sce", Geohash.containingGeohash(envelope)); + } + }