@Test
public void testSampler() {
BoundingBox bbox = new BoundingBox(37.7, 37.84, -122.52, -122.35);
BoundingBoxSampler sampler = new BoundingBoxSampler(TwoGeoHashBoundingBox.withBitPrecision(bbox, 35), 1179);
bbox = sampler.getBoundingBox().getBoundingBox();
GeoHash gh = sampler.next();
Set<String> hashes = new HashSet<String>();
int sumOfComp = 0;
int crossingZero = 0;
GeoHash prev = null;
while (gh != null) {
assertTrue(bbox.contains(gh.getPoint()));
assertFalse(hashes.contains(gh.toBase32()));
hashes.add(gh.toBase32());
if (prev != null) {
sumOfComp += prev.compareTo(gh);
}
prev = gh;
if (sumOfComp == 0) {
crossingZero++;
}