Skip to content

Commit 21002ae

Browse files
evetionyeesian
authored andcommitted
Add regression testing (#38)
* Added latest bugfix release of LibGEOS for this minor version. * Added regression testing. * Added tests for old issues, added tests for invalid geometry that crash on Windows. * Commented out test runs. * Used incorrect Polygon on which an error should be thrown.
1 parent b2ade20 commit 21002ae

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ using FactCheck, LibGEOS
44
include("test_geos_functions.jl")
55
include("test_geos_operations.jl")
66
include("test_geo_interface.jl")
7+
include("test_regressions.jl")
8+
include("test_invalid_geometry.jl")
79

810
FactCheck.exitstatus()

test/test_invalid_geometry.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
facts("LibGEOS invalid geometry") do
2+
# LibGEOS shouldn't crash but error out
3+
# on invalid geometry
4+
5+
# Self intersecting polygon
6+
polygon = LibGEOS.geomFromWKT("POLYGON((0 0, 10 10, 0 10, 10 0, 0 0))")
7+
@fact LibGEOS.isValid(polygon) --> false
8+
9+
# Hole outside of base
10+
polygon = LibGEOS.geomFromWKT("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0), (15 15, 15 20, 20 20, 20 15, 15 15))")
11+
@fact LibGEOS.isValid(polygon) --> false
12+
13+
end

test/test_regressions.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
facts("LibGEOS regressions") do
2+
3+
# https://github.com/JuliaGeo/LibGEOS.jl/issues/29
4+
pts = [[0.,0.],[10.,0.], [10.,10.],[0.,10.]]
5+
@fact_throws polygon = Polygon([pts])
6+
7+
# https://github.com/JuliaGeo/LibGEOS.jl/issues/24
8+
point = Point(2, 3)
9+
@fact GeoInterface.geotype(point) --> :Point
10+
11+
# https://github.com/JuliaGeo/LibGEOS.jl/issues/25
12+
a = LibGEOS.createCoordSeq([0.0, 2.0])
13+
@fact LibGEOS.getCoordinates(a) --> Array{Float64,1}[[0.0,2.0]]
14+
15+
# https://github.com/JuliaGeo/LibGEOS.jl/issues/12
16+
mp = LibGEOS.MultiPoint(Vector{Float64}[[0,0],[10,0],[10,10],[11,10]])
17+
@fact GeoInterface.geotype(mp) --> :MultiPoint
18+
19+
end

0 commit comments

Comments
 (0)