From 84ef58e8b5f5dc4d1ff208a769a3e7a13c1640d1 Mon Sep 17 00:00:00 2001 From: --replace-all Date: Sun, 3 Mar 2024 11:02:32 +0100 Subject: [PATCH] test: Added some tests for toGeohash #213 --- .../java/com/esri/core/geometry/TestGeohash.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/com/esri/core/geometry/TestGeohash.java b/src/test/java/com/esri/core/geometry/TestGeohash.java index a853405b..e09e7150 100644 --- a/src/test/java/com/esri/core/geometry/TestGeohash.java +++ b/src/test/java/com/esri/core/geometry/TestGeohash.java @@ -72,4 +72,19 @@ public void testGeohashToEnvelopeGoodDimensions2(){ assertEquals(latDiff, env.ymax-env.ymin, delta); } + @Test + public void testToGeohashHasGoodPrecision(){ + Point2D point = new Point2D(18.068581, 59.329323); + assertEquals(6, Geohash.toGeohash(point, 6).length()); + } + + @Test + public void testToGeohash(){ + String expected = "u6sce"; + Point2D point = new Point2D(18.068581, 59.329323); + String geoHash = Geohash.toGeohash(point, 5); + + assertEquals(expected, geoHash); + } + }