Skip to content

Commit

Permalink
format gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
TuSKan committed Mar 4, 2024
1 parent b02fe35 commit dafdf7c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 43 deletions.
2 changes: 1 addition & 1 deletion contains.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func pnPoly(coords []Coord, pt Coord) bool {
return in
}

// ContainsPoint reports whether a geometry T contains the given point
// ContainsPoint reports whether a geometry T contains the given point.
func ContainsPoint(geo T, point *Point) bool {
if geo.Bounds().OverlapsPoint(point.Layout(), point.Coords()) {
zero := NewPoint(point.Layout()).Coords()
Expand Down
82 changes: 40 additions & 42 deletions contains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,50 @@ import (
"github.com/stretchr/testify/assert"
)

var (
testGeo = []struct {
geom T
pts []*Point
in []bool
}{
{
NewPolygon(XY).MustSetCoords([][]Coord{
{
{24.950899, 60.169158},
{24.953492, 60.169158},
{24.953510, 60.170104},
{24.950958, 60.169990},
{24.950899, 60.169158},
},
}),
[]*Point{
NewPoint(XY).MustSetCoords(Coord{24.952242, 60.1696017}),
NewPoint(XY).MustSetCoords(Coord{24.976567, 60.1612500}),
},
[]bool{
true,
false,
var testGeo = []struct {
geom T
pts []*Point
in []bool
}{
{
NewPolygon(XY).MustSetCoords([][]Coord{
{
{24.950899, 60.169158},
{24.953492, 60.169158},
{24.953510, 60.170104},
{24.950958, 60.169990},
{24.950899, 60.169158},
},
}),
[]*Point{
NewPoint(XY).MustSetCoords(Coord{24.952242, 60.1696017}),
NewPoint(XY).MustSetCoords(Coord{24.976567, 60.1612500}),
},
{
NewPolygon(XY).MustSetCoords([][]Coord{
{
{40.7711, -73.9345},
{40.7710, -73.9342},
{40.7704, -73.9344},
{40.7702, -73.9345},
{40.7711, -73.9345},
},
}),
[]*Point{
NewPoint(XY).MustSetCoords(Coord{40.7705, -73.9394}),
NewPoint(XY).MustSetCoords(Coord{40.7707, -73.9344}),
},
[]bool{
false,
true,
[]bool{
true,
false,
},
},
{
NewPolygon(XY).MustSetCoords([][]Coord{
{
{40.7711, -73.9345},
{40.7710, -73.9342},
{40.7704, -73.9344},
{40.7702, -73.9345},
{40.7711, -73.9345},
},
}),
[]*Point{
NewPoint(XY).MustSetCoords(Coord{40.7705, -73.9394}),
NewPoint(XY).MustSetCoords(Coord{40.7707, -73.9344}),
},
}
)
[]bool{
false,
true,
},
},
}

func TestContain(t *testing.T) {
for i, test := range testGeo {
Expand Down

0 comments on commit dafdf7c

Please sign in to comment.