Adding unit test for even / odd boundary condition

This commit is contained in:
Nicholas Knize 2014-11-24 13:52:06 -06:00
parent 15db5b98d2
commit 6692ac3b75
1 changed files with 15 additions and 0 deletions

View File

@ -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);
}
}