mirror of https://github.com/tidwall/tile38.git
23 lines
830 B
Go
23 lines
830 B
Go
|
package geojson
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestMultiLineString(t *testing.T) {
|
||
|
expectJSON(t, `{"type":"MultiLineString","coordinates":[[[1,2,3]]]}`, errCoordinatesInvalid)
|
||
|
expectJSON(t, `{"type":"MultiLineString","coordinates":[[[1,2]]],"bbox":null}`, errCoordinatesInvalid)
|
||
|
expectJSON(t, `{"type":"MultiLineString"}`, errCoordinatesMissing)
|
||
|
expectJSON(t, `{"type":"MultiLineString","coordinates":null}`, errCoordinatesInvalid)
|
||
|
expectJSON(t, `{"type":"MultiLineString","coordinates":[1,null]}`, errCoordinatesInvalid)
|
||
|
}
|
||
|
|
||
|
func TestMultiLineStringPoly(t *testing.T) {
|
||
|
p := expectJSON(t, `{"type":"MultiLineString","coordinates":[
|
||
|
[[10,10],[20,20]],
|
||
|
[[50,50],[100,100]]
|
||
|
]}`, nil)
|
||
|
expect(t, p.Intersects(PO(15, 15)))
|
||
|
expect(t, p.Contains(PO(15, 15)))
|
||
|
expect(t, p.Contains(PO(70, 70)))
|
||
|
expect(t, !p.Contains(PO(40, 40)))
|
||
|
}
|