예제 #1
0
func TestContainsAround180Longitude(t *testing.T) {
	b, err := NewBoundingBox(
		Coordinate{Lat: 1.0, Lng: 179.0},
		Coordinate{Lat: 2.0, Lng: -179.0})

	gt.AssertNil(t, err)

	gt.AssertTrueM(t, b.Contains(&Coordinate{Lat: 1.5, Lng: -179.9}), "In Box (E)")
	gt.AssertTrueM(t, b.Contains(&Coordinate{Lat: 1.5, Lng: 179.9}), "In Box (W)")

	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: 1.5, Lng: 178}), "East")
	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: 1.5, Lng: -178}), "West")
}
예제 #2
0
func TestDisplayPage(t *testing.T) {
	cfg := &Environment{}

	u := "http://myhost.com/display/100-1-2-3.png"
	res := execute(t, u, ResultPageHandler, cfg)

	gt.AssertEqualM(t, http.StatusOK, res.StatusCode, "")
	gt.AssertTrueM(t, strings.Contains(res.Body, "loadImage('100-1-2-3.png'"),
		"Missing expected loadImage call in ["+res.Body+"]")
}
예제 #3
0
func TestContainsAround0Latitude(t *testing.T) {
	b, err := NewBoundingBox(
		Coordinate{Lat: -1.0, Lng: 1.0},
		Coordinate{Lat: 1.0, Lng: 2.0})

	gt.AssertNil(t, err)

	gt.AssertTrueM(t, b.Contains(&Coordinate{Lat: 0, Lng: 1.5}), "In Box")

	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: -1.5, Lng: 1.5}), "East")
	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: 2.5, Lng: 1.5}), "West")
}
예제 #4
0
func TestContainsSE(t *testing.T) {
	b, err := NewBoundingBox(
		Coordinate{Lat: 1.0, Lng: -2.0},
		Coordinate{Lat: 2.0, Lng: -1.0})

	gt.AssertNil(t, err)

	gt.AssertTrueM(t, b.Contains(&Coordinate{Lat: 1.5, Lng: -1.5}), "In Box")

	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: 0.5, Lng: -1.5}), "East")
	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: 2.5, Lng: -1.5}), "West")
	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: 1.5, Lng: -2.5}), "South")
	gt.AssertFalseM(t, b.Contains(&Coordinate{Lat: 1.5, Lng: -0.5}), "North")
}