* Created by IntelliJ IDEA. User: kevin Date: Jan 17, 2011 Time: 12:48:55 PM
*/
public class BoundingBoxSamplerTest {
@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);
}