Skip to content

Commit cb87b80

Browse files
committed
add missing tests
1 parent ce7f3e2 commit cb87b80

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/geointerface.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
@testset "Basic types" begin
22
point = Point(2, 3)
3+
@test geomtrait(point) isa PointTrait
34
@test testgeometry(point)
45
@test ncoord(point) == 2
56
@test getcoord(point, 2) == 3
67
@test GeoInterface.coordinates(point) == [2, 3]
78

9+
line = Line(Point(2, 3), Point(4, 5))
10+
@test geomtrait(line) isa LineTrait
11+
@test testgeometry(line)
12+
@test ngeom(line) == 2
13+
@test getgeom(line, 2) == Point(4, 5)
14+
@test GeoInterface.coordinates(line) == [[2, 3], [4, 5]]
15+
816
mp = MultiPoint([point, point])
17+
@test geomtrait(mp) isa MultiPointTrait
918
@test testgeometry(mp)
1019
@test ngeom(mp) == 2
1120
@test getgeom(mp, 2) == point
1221
@test GeoInterface.coordinates(mp) == [[2, 3], [2, 3]]
1322

1423
linestring = LineString(Point{2,Int}[(10, 10), (20, 20), (10, 40)])
24+
@test geomtrait(linestring) isa LineStringTrait
1525
@test testgeometry(linestring)
1626
@test ngeom(linestring) == 3
1727
@test ncoord(linestring) == 2
@@ -21,22 +31,26 @@
2131
@test GeoInterface.coordinates(linestring) == [[10, 10], [20, 20], [10, 40]]
2232

2333
multilinestring = MultiLineString([linestring, linestring])
34+
@test geomtrait(multilinestring) isa MultiLineStringTrait
2435
@test testgeometry(multilinestring)
2536
@test GeoInterface.coordinates(multilinestring) ==
2637
[[[10, 10], [20, 20], [10, 40]], [[10, 10], [20, 20], [10, 40]]]
2738
@test ncoord(multilinestring) == 2
2839

2940
poly = Polygon(rand(Point{2,Float32}, 5), [rand(Point{2,Float32}, 5)])
41+
@test geomtrait(poly) isa PolygonTrait
3042
@test testgeometry(poly)
3143
@test length(GeoInterface.coordinates(poly)) == 2
3244
@test length(GeoInterface.coordinates(poly)[1]) == 5
3345

3446
triangle = Triangle(point, point, point)
47+
@test geomtrait(triangle) isa PolygonTrait # ?? should it be a Triangle trait
3548
@test testgeometry(triangle)
3649
@test length(GeoInterface.coordinates(triangle)) == 1
3750
@test length(GeoInterface.coordinates(triangle)[1]) == 3
3851

3952
polys = MultiPolygon([poly, poly])
53+
@test geomtrait(polys) isa MultiPolygonTrait
4054
@test testgeometry(polys)
4155
@test length(GeoInterface.coordinates(polys)) == 2
4256
@test length(GeoInterface.coordinates(polys)[1]) == 2

0 commit comments

Comments
 (0)