func TestBoundingBox(t *testing.T) {
	for _, c := range testcases {
		box := BoundingBox(c.hash)
		if !box.Contains(c.lat, c.lng) {
			t.Errorf("incorrect bounding box for %s", c.hash)
		}
	}
}
Test bounding boxes for string geohashes.
package geohash
import (
	"math"
	"testing"
)
type TestCase struct {
	hashInt  uint64
	hash     string
	lat, lng float64
}
func TestEncode(t *testing.T) {
	for _, c := range testcases {
		hash := Encode(c.lat, c.lng)
		if c.hash != hash {
			t.Errorf("incorrect encode string result for (%v,%v): %s != %s",
				c.lat, c.lng, c.hash, hash)
		}
	}
}
func TestEncodeInt(t *testing.T) {
	for _, c := range testcases {
		hashInt := EncodeInt(c.lat, c.lng)
		if c.hashInt != hashInt {
			t.Errorf("incorrect encode integer result for (%v,%v): %016x != %016x xor %016x",
				c.lat, c.lng, c.hashInt, hashInt, c.hashInt^hashInt)
		}
	}
}
func TestPrefixProperty(t *testing.T) {
	for _, c := range testcases {
		for chars := uint(1); chars <= 12; chars++ {
			hash := EncodeWithPrecision(c.lat, c.lng, chars)
			pre := c.hash[:chars]
			if pre != hash {
				t.Errorf("incorrect encode string result for (%v,%v) at precision %d: %s != %s",
					c.lat, c.lng, chars, pre, hash)
			}
		}
	}
}
func TestValidate(t *testing.T) {
	for _, c := range testcases {
		if err := Validate(c.hash); err != nil {
			t.Fatalf("unexpected error for %q: %s", c.hash, err)
		}
	}
}