Skip to content

Commit db97d3a

Browse files
visryeesian
authored andcommitted
Move from FactCheck to Base.Test (#44)
* Fix deprecations * No CI on julia v0.5 * Move from FactCheck to Base.Test * Comment out failing test until we address #21
1 parent ad8bf4d commit db97d3a

File tree

11 files changed

+255
-257
lines changed

11 files changed

+255
-257
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ os:
33
- osx
44
- linux
55
julia:
6-
- 0.5
76
- 0.6
87
- nightly
98
matrix:

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
environment:
22
matrix:
3-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
4-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
53
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
64
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
75
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"

src/LibGEOS.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module LibGEOS
2626

2727
include("geos_c.jl")
2828

29-
type GEOSError <: Exception
29+
mutable struct GEOSError <: Exception
3030
msg::String
3131
end
3232
Base.showerror(io::IO, err::GEOSError) = print(io, "GEOSError\n\t$(err.msg)")
@@ -39,7 +39,7 @@ module LibGEOS
3939
end
4040
end
4141

42-
type GEOSconnection
42+
mutable struct GEOSconnection
4343
status::Symbol
4444

4545
function GEOSconnection()

src/geos_types.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type Point <: GeoInterface.AbstractPoint
1+
mutable struct Point <: GeoInterface.AbstractPoint
22
ptr::GEOSGeom
33

44
function Point(ptr::GEOSGeom)
@@ -9,10 +9,10 @@ type Point <: GeoInterface.AbstractPoint
99
Point(coords::Vector{Float64}) = Point(createPoint(coords))
1010
Point(x::Real, y::Real) = Point(createPoint(x,y))
1111
Point(x::Real, y::Real, z::Real) = Point(createPoint(x,y,z))
12-
Point{T<:GeoInterface.AbstractPoint}(obj::T) = Point(GeoInterface.coordinates(obj))
12+
Point(obj::T) where {T<:GeoInterface.AbstractPoint} = Point(GeoInterface.coordinates(obj))
1313
end
1414

15-
type MultiPoint <: GeoInterface.AbstractMultiPoint
15+
mutable struct MultiPoint <: GeoInterface.AbstractMultiPoint
1616
ptr::GEOSGeom
1717

1818
function MultiPoint(ptr::GEOSGeom)
@@ -21,10 +21,10 @@ type MultiPoint <: GeoInterface.AbstractMultiPoint
2121
multipoint
2222
end
2323
MultiPoint(multipoint::Vector{Vector{Float64}}) = MultiPoint(createCollection(GEOS_MULTIPOINT, GEOSGeom[createPoint(coords) for coords in multipoint]))
24-
MultiPoint{T<:GeoInterface.AbstractMultiPoint}(obj::T) = MultiPoint(GeoInterface.coordinates(obj))
24+
MultiPoint(obj::T) where {T<:GeoInterface.AbstractMultiPoint} = MultiPoint(GeoInterface.coordinates(obj))
2525
end
2626

27-
type LineString <: GeoInterface.AbstractLineString
27+
mutable struct LineString <: GeoInterface.AbstractLineString
2828
ptr::GEOSGeom
2929

3030
function LineString(ptr::GEOSGeom)
@@ -33,10 +33,10 @@ type LineString <: GeoInterface.AbstractLineString
3333
line
3434
end
3535
LineString(line::Vector{Vector{Float64}}) = LineString(createLineString(line))
36-
LineString{T<:GeoInterface.AbstractLineString}(obj::T) = LineString(GeoInterface.coordinates(obj))
36+
LineString(obj::T) where {T<:GeoInterface.AbstractLineString} = LineString(GeoInterface.coordinates(obj))
3737
end
3838

39-
type MultiLineString <: GeoInterface.AbstractMultiLineString
39+
mutable struct MultiLineString <: GeoInterface.AbstractMultiLineString
4040
ptr::GEOSGeom
4141

4242
function MultiLineString(ptr::GEOSGeom)
@@ -45,10 +45,10 @@ type MultiLineString <: GeoInterface.AbstractMultiLineString
4545
multiline
4646
end
4747
MultiLineString(multiline::Vector{Vector{Vector{Float64}}}) = MultiLineString(createCollection(GEOS_MULTILINESTRING, GEOSGeom[createLineString(coords) for coords in multiline]))
48-
MultiLineString{T<:GeoInterface.AbstractMultiLineString}(obj::T) = MultiLineString(GeoInterface.coordinates(obj))
48+
MultiLineString(obj::T) where {T<:GeoInterface.AbstractMultiLineString} = MultiLineString(GeoInterface.coordinates(obj))
4949
end
5050

51-
type LinearRing <: GeoInterface.AbstractLineString
51+
mutable struct LinearRing <: GeoInterface.AbstractLineString
5252
ptr::GEOSGeom
5353

5454
function LinearRing(ptr::GEOSGeom)
@@ -57,10 +57,10 @@ type LinearRing <: GeoInterface.AbstractLineString
5757
ring
5858
end
5959
LinearRing(ring::Vector{Vector{Float64}}) = LinearRing(createLinearRing(ring))
60-
LinearRing{T<:GeoInterface.AbstractLineString}(obj::T) = LinearRing(GeoInterface.coordinates(obj))
60+
LinearRing(obj::T) where {T<:GeoInterface.AbstractLineString} = LinearRing(GeoInterface.coordinates(obj))
6161
end
6262

63-
type Polygon <: GeoInterface.AbstractPolygon
63+
mutable struct Polygon <: GeoInterface.AbstractPolygon
6464
ptr::GEOSGeom
6565

6666
function Polygon(ptr::GEOSGeom)
@@ -75,10 +75,10 @@ type Polygon <: GeoInterface.AbstractPolygon
7575
finalizer(polygon, destroyGeom)
7676
polygon
7777
end
78-
Polygon{T<:GeoInterface.AbstractPolygon}(obj::T) = Polygon(GeoInterface.coordinates(obj))
78+
Polygon(obj::T) where {T<:GeoInterface.AbstractPolygon} = Polygon(GeoInterface.coordinates(obj))
7979
end
8080

81-
type MultiPolygon <: GeoInterface.AbstractMultiPolygon
81+
mutable struct MultiPolygon <: GeoInterface.AbstractMultiPolygon
8282
ptr::GEOSGeom
8383

8484
function MultiPolygon(ptr::GEOSGeom)
@@ -91,10 +91,10 @@ type MultiPolygon <: GeoInterface.AbstractMultiPolygon
9191
GEOSGeom[createPolygon(createLinearRing(coords[1]),
9292
GEOSGeom[createLinearRing(c) for c in coords[2:end]])
9393
for coords in multipolygon]))
94-
MultiPolygon{T<:GeoInterface.AbstractMultiPolygon}(obj::T) = MultiPolygon(GeoInterface.coordinates(obj))
94+
MultiPolygon(obj::T) where {T<:GeoInterface.AbstractMultiPolygon} = MultiPolygon(GeoInterface.coordinates(obj))
9595
end
9696

97-
type GeometryCollection <: GeoInterface.AbstractGeometryCollection
97+
mutable struct GeometryCollection <: GeoInterface.AbstractGeometryCollection
9898
ptr::GEOSGeom
9999

100100
function GeometryCollection(ptr::GEOSGeom)

test/REQUIRE

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/runtests.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import GeoInterface
2-
using FactCheck, LibGEOS
2+
using Base.Test, LibGEOS
33

4-
include("test_geos_functions.jl")
5-
include("test_geos_operations.jl")
6-
include("test_geo_interface.jl")
7-
include("test_regressions.jl")
8-
include("test_invalid_geometry.jl")
9-
10-
FactCheck.exitstatus()
4+
@testset "LibGEOS" begin
5+
include("test_geos_functions.jl")
6+
include("test_geos_operations.jl")
7+
include("test_geo_interface.jl")
8+
include("test_regressions.jl")
9+
include("test_invalid_geometry.jl")
10+
end

test/test_geo_interface.jl

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
facts("Geo interface") do
1+
@testset "Geo interface" begin
22
pt = LibGEOS.Point(1.0,2.0)
3-
@fact GeoInterface.coordinates(pt) --> roughly([1,2], 1e-5)
4-
@fact GeoInterface.geotype(pt) --> :Point
3+
@test GeoInterface.coordinates(pt) [1,2] atol=1e-5
4+
@test GeoInterface.geotype(pt) == :Point
55

66
pt = LibGEOS.Point(1, 2)
7-
@fact GeoInterface.coordinates(pt) --> roughly([1,2], 1e-5)
8-
@fact GeoInterface.geotype(pt) --> :Point
7+
@test GeoInterface.coordinates(pt) [1,2] atol=1e-5
8+
@test GeoInterface.geotype(pt) == :Point
99

1010

1111
pt = LibGEOS.Point(LibGEOS.geomFromWKT("POINT EMPTY"))
12-
@fact GeoInterface.coordinates(pt) --> roughly(Float64[], 1e-5)
13-
@fact GeoInterface.geotype(pt) --> :Point
12+
@test GeoInterface.coordinates(pt) Float64[] atol=1e-5
13+
@test GeoInterface.geotype(pt) == :Point
1414

1515
mpt = LibGEOS.MultiPoint(LibGEOS.geomFromWKT("MULTIPOINT(0 0, 10 0, 10 10, 11 10)"))
16-
@fact GeoInterface.coordinates(mpt) --> Vector{Float64}[[0,0],[10,0],[10,10],[11,10]]
17-
@fact GeoInterface.geotype(mpt) --> :MultiPoint
16+
@test GeoInterface.coordinates(mpt) == Vector{Float64}[[0,0],[10,0],[10,10],[11,10]]
17+
@test GeoInterface.geotype(mpt) == :MultiPoint
1818

1919
coords = Vector{Float64}[[8,1],[9,1],[9,2],[8,2]]
2020
ls = LibGEOS.LineString(coords)
21-
@fact GeoInterface.coordinates(ls) --> coords
22-
@fact GeoInterface.geotype(ls) --> :LineString
21+
@test GeoInterface.coordinates(ls) == coords
22+
@test GeoInterface.geotype(ls) == :LineString
2323

2424
ls = LibGEOS.LineString(LibGEOS.geomFromWKT("LINESTRING EMPTY"))
25-
@fact GeoInterface.coordinates(ls) --> []
26-
@fact GeoInterface.geotype(ls) --> :LineString
25+
@test GeoInterface.coordinates(ls) == []
26+
@test GeoInterface.geotype(ls) == :LineString
2727

2828
mls = LibGEOS.MultiLineString(LibGEOS.geomFromWKT("MULTILINESTRING ((5 0, 10 0), (0 0, 5 0))"))
29-
@fact GeoInterface.coordinates(mls) --> [[[5,0],[10,0]],[[0,0],[5,0]]]
30-
@fact GeoInterface.geotype(mls) --> :MultiLineString
29+
@test GeoInterface.coordinates(mls) == [[[5,0],[10,0]],[[0,0],[5,0]]]
30+
@test GeoInterface.geotype(mls) == :MultiLineString
3131

3232
coords = Vector{Float64}[[8,1],[9,1],[9,2],[8,2],[8,1]]
3333
lr = LibGEOS.LinearRing(coords)
34-
@fact GeoInterface.coordinates(lr) --> coords
35-
@fact GeoInterface.geotype(lr) --> :LineString
34+
@test GeoInterface.coordinates(lr) == coords
35+
@test GeoInterface.geotype(lr) == :LineString
3636

3737
coords = Vector{Vector{Float64}}[Vector{Float64}[[0,0],[10,0],[10,10],[0,10],[0,0]],
3838
Vector{Float64}[[1,8],[2,8],[2,9],[1,9],[1,8]],
3939
Vector{Float64}[[8,1],[9,1],[9,2],[8,2],[8,1]]]
4040
polygon = LibGEOS.Polygon(coords)
41-
@fact GeoInterface.coordinates(polygon) --> coords
42-
@fact GeoInterface.geotype(polygon) --> :Polygon
41+
@test GeoInterface.coordinates(polygon) == coords
42+
@test GeoInterface.geotype(polygon) == :Polygon
4343

4444
polygon = LibGEOS.Polygon(LibGEOS.geomFromWKT("POLYGON EMPTY"))
45-
@fact GeoInterface.coordinates(polygon) --> [[]]
46-
@fact GeoInterface.geotype(polygon) --> :Polygon
45+
@test GeoInterface.coordinates(polygon) == [[]]
46+
@test GeoInterface.geotype(polygon) == :Polygon
4747

4848
multipolygon = LibGEOS.MultiPolygon(LibGEOS.geomFromWKT("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))"))
49-
@fact GeoInterface.coordinates(multipolygon) --> Vector{Vector{Vector{Float64}}}[Vector{Vector{Float64}}[Vector{Float64}[[0,0],[0,10],[10,10],[10,0],[0,0]]]]
50-
@fact GeoInterface.geotype(multipolygon) --> :MultiPolygon
49+
@test GeoInterface.coordinates(multipolygon) == Vector{Vector{Vector{Float64}}}[Vector{Vector{Float64}}[Vector{Float64}[[0,0],[0,10],[10,10],[10,0],[0,0]]]]
50+
@test GeoInterface.geotype(multipolygon) == :MultiPolygon
5151

5252
geomcollection = LibGEOS.GeometryCollection(LibGEOS.geomFromWKT("GEOMETRYCOLLECTION (POLYGON ((8 2, 10 10, 8.5 1, 8 2)), POLYGON ((7 8, 10 10, 8 2, 7 8)), POLYGON ((3 8, 10 10, 7 8, 3 8)), POLYGON ((2 2, 8 2, 8.5 1, 2 2)), POLYGON ((2 2, 7 8, 8 2, 2 2)), POLYGON ((2 2, 3 8, 7 8, 2 2)), POLYGON ((0.5 9, 10 10, 3 8, 0.5 9)), POLYGON ((0.5 9, 3 8, 2 2, 0.5 9)), POLYGON ((0 0, 2 2, 8.5 1, 0 0)), POLYGON ((0 0, 0.5 9, 2 2, 0 0)))"))
5353
collection = GeoInterface.geometries(geomcollection)
@@ -61,8 +61,8 @@ facts("Geo interface") do
6161
Vector{Vector{Float64}}[Vector{Float64}[[0.5,9.0],[ 3.0, 8.0],[2.0,2.0],[0.5,9.0]]],
6262
Vector{Vector{Float64}}[Vector{Float64}[[0.0,0.0],[ 2.0, 2.0],[8.5,1.0],[0.0,0.0]]],
6363
Vector{Vector{Float64}}[Vector{Float64}[[0.0,0.0],[ 0.5, 9.0],[2.0,2.0],[0.0,0.0]]]]
64-
@fact map(GeoInterface.coordinates,collection) --> coords
65-
@fact GeoInterface.geotype(geomcollection) --> :GeometryCollection
64+
@test map(GeoInterface.coordinates,collection) == coords
65+
@test GeoInterface.geotype(geomcollection) == :GeometryCollection
6666

6767
geomcollection = LibGEOS.GeometryCollection(LibGEOS.geomFromWKT("GEOMETRYCOLLECTION(MULTIPOINT(0 0, 0 0, 1 1),LINESTRING(1 1, 2 2, 2 2, 0 0),POLYGON((5 5, 0 0, 0 2, 2 2, 5 5)))"))
6868
collection = GeoInterface.geometries(geomcollection)
@@ -71,13 +71,13 @@ facts("Geo interface") do
7171
Vector{Vector{Float64}}[Vector{Float64}[[5.0,5.0],[0.0,0.0],[0.0,2.0],[2.0,2.0],[5.0,5.0]]]]
7272
geotypes = [:MultiPoint,:LineString,:Polygon]
7373
for (i,item) in enumerate(collection)
74-
@fact GeoInterface.coordinates(item) --> coords[i]
75-
@fact GeoInterface.geotype(item) --> geotypes[i]
74+
@test GeoInterface.coordinates(item) == coords[i]
75+
@test GeoInterface.geotype(item) == geotypes[i]
7676
end
77-
@fact GeoInterface.geotype(geomcollection) --> :GeometryCollection
77+
@test GeoInterface.geotype(geomcollection) == :GeometryCollection
7878

7979
geomcollection = LibGEOS.GeometryCollection(LibGEOS.geomFromWKT("GEOMETRYCOLLECTION EMPTY"))
8080
collection = GeoInterface.geometries(geomcollection)
81-
@fact length(collection) --> 0
82-
@fact GeoInterface.geotype(geomcollection) --> :GeometryCollection
81+
@test length(collection) == 0
82+
@test GeoInterface.geotype(geomcollection) == :GeometryCollection
8383
end

0 commit comments

Comments
 (0)