From 6692ac3b750efda055dfc44395748aa5136c4198 Mon Sep 17 00:00:00 2001 From: Nicholas Knize Date: Mon, 24 Nov 2014 13:52:06 -0600 Subject: [PATCH] Adding unit test for even / odd boundary condition --- .../index/search/geo/GeoHashUtilsTests.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/org/elasticsearch/index/search/geo/GeoHashUtilsTests.java b/src/test/java/org/elasticsearch/index/search/geo/GeoHashUtilsTests.java index 72b86a269cf..49e1b4d0dc6 100644 --- a/src/test/java/org/elasticsearch/index/search/geo/GeoHashUtilsTests.java +++ b/src/test/java/org/elasticsearch/index/search/geo/GeoHashUtilsTests.java @@ -134,5 +134,20 @@ public class GeoHashUtilsTests extends ElasticsearchTestCase { neighbors = new ArrayList<>(); GeoHashUtils.addNeighbors(geohash, neighbors ); assertEquals(expectedNeighbors, neighbors); + + // Border even and odd geohash + geohash = "ezzzz"; + expectedNeighbors = new ArrayList<>(); + expectedNeighbors.add("gbpbn"); + expectedNeighbors.add("gbpbp"); + expectedNeighbors.add("u0000"); + expectedNeighbors.add("ezzzy"); + expectedNeighbors.add("spbpb"); + expectedNeighbors.add("ezzzw"); + expectedNeighbors.add("ezzzx"); + expectedNeighbors.add("spbp8"); + neighbors = new ArrayList<>(); + GeoHashUtils.addNeighbors(geohash, neighbors ); + assertEquals(expectedNeighbors, neighbors); } }