Skip to content

Commit d65696c

Browse files
committed
Add tests for polygon
1 parent 4a14d1d commit d65696c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/runtests.jl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,21 @@ end
373373
@test coordinates(m) === points
374374

375375
linestring = LineString(Point{2, Int}[(10, 10), (20, 20), (10, 40)])
376-
@test decompose(Point{2, Int}, linestring) == Point{2, Int64}[[10, 10], [20, 20], [10, 40]]
376+
pts = Point{2, Int}[(10, 10), (20, 20), (10, 40)]
377+
linestring = LineString(pts)
378+
pts_decomp = decompose(Point{2, Int}, linestring)
379+
@test pts === pts_decomp
380+
381+
pts_ext = Point{2, Int}[(5, 1), (3, 3), (4, 8), (1, 2), (5, 1)]
382+
ls_ext = LineString(pts_ext)
383+
pts_int1 = Point{2, Int}[(2, 2), (3, 8),(5, 6), (3, 4), (2, 2)]
384+
ls_int1 = LineString(pts_int1)
385+
pts_int2 = Point{2, Int}[(3, 2), (4, 5),(6, 1), (1, 4), (3, 2)]
386+
ls_int2 = LineString(pts_int2)
387+
poly_ext = Polygon(ls_ext)
388+
poly_ext_int = Polygon(ls_ext, [ls_int1, ls_int2])
389+
@test decompose(Point{2, Int}, poly_ext) == pts_ext
390+
@test decompose(Point{2, Int}, poly_ext_int) == [pts_ext..., pts_int1..., pts_int2...]
377391
end
378392

379393
@testset "convert mesh + meta" begin

0 commit comments

Comments
 (0)