mirror of https://github.com/tidwall/tile38.git
19 lines
836 B
Go
19 lines
836 B
Go
package geojson
|
|
|
|
import "testing"
|
|
|
|
func TestGeometryCollection(t *testing.T) {
|
|
p := expectJSON(t, `{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1,2,3]}]}`, nil)
|
|
expect(t, p.Center() == P(1, 2))
|
|
expectJSON(t, `{"type":"GeometryCollection"}`, errGeometriesMissing)
|
|
expectJSON(t, `{"type":"GeometryCollection","geometries":null}`, errGeometriesInvalid)
|
|
expectJSON(t, `{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1,2,3]}],"bbox":null}`, nil)
|
|
expectJSON(t, `{"type":"GeometryCollection","geometries":[{"type":"Point"}]}`, errCoordinatesMissing)
|
|
}
|
|
|
|
func TestGeometryCollectionPoly(t *testing.T) {
|
|
p := expectJSON(t, `{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1,2]}]}`, nil)
|
|
expect(t, p.Intersects(PO(1, 2)))
|
|
expect(t, p.Contains(PO(1, 2)))
|
|
}
|