1- using LibGEOS, FactCheck
2- import GeoInterface
3-
4- function equivalent_to_wkt (geom:: GeoInterface.AbstractGeometry , wkt:: ASCIIString )
1+ function equivalent_to_wkt (geom:: GeoInterface.AbstractGeometry , wkt:: Compat.ASCIIString )
52 test_geom = parseWKT (wkt)
63 @fact geomToWKT (geom) --> geomToWKT (test_geom)
74end
85
9- function factcheck (f:: Function , geom:: ASCIIString , expected:: ASCIIString )
6+ function factcheck (f:: Function , geom:: Compat. ASCIIString , expected:: Compat. ASCIIString )
107 result = f (parseWKT (geom))
118 equivalent_to_wkt (result, expected)
129end
1310
14- function factcheck (f:: Function , geom:: ASCIIString , expected:: Bool )
11+ function factcheck (f:: Function , geom:: Compat. ASCIIString , expected:: Bool )
1512 @fact f (parseWKT (geom)) --> expected
1613end
1714
18- function factcheck (f:: Function , g1:: ASCIIString , g2:: ASCIIString , expected:: ASCIIString )
15+ function factcheck (f:: Function , g1:: Compat. ASCIIString , g2:: Compat. ASCIIString , expected:: Compat. ASCIIString )
1916 result = f (parseWKT (g1),parseWKT (g2))
2017 equivalent_to_wkt (result, expected)
2118end
2219
23- function factcheck (f:: Function , g1:: ASCIIString , g2:: ASCIIString , expected:: Bool )
20+ function factcheck (f:: Function , g1:: Compat. ASCIIString , g2:: Compat. ASCIIString , expected:: Bool )
2421 @fact f (parseWKT (g1),parseWKT (g2)) --> expected
2522end
2623
@@ -52,6 +49,7 @@ g2 = parseWKT("POLYGON((1 1,1 2,2 2,2 1,1 1))")
5249@fact LibGEOS. contains (g1, g2) --> true
5350@fact LibGEOS. contains (g1, g2) --> false
5451
52+
5553# GEOSConvexHullTest
5654input = parseWKT (" MULTIPOINT (130 240, 130 240, 130 240, 570 240, 570 240, 570 240, 650 240)" )
5755expected = parseWKT (" LINESTRING (130 240, 650 240)" )
@@ -100,14 +98,14 @@ g1 = parseWKT("GEOMETRYCOLLECTION(MULTIPOINT(0 0, 0 0, 1 1),LINESTRING(1 1, 2 2,
10098@fact LibGEOS. equals (uniquePoints (g1), parseWKT (" MULTIPOINT(0 0, 1 1, 2 2, 5 5, 0 2)" )) --> true
10199
102100# GEOSGetCentroidTest
103- test_centroid (geom:: ASCIIString , expected:: ASCIIString ) = factcheck (centroid, geom, expected)
101+ test_centroid (geom:: Compat. ASCIIString , expected:: Compat. ASCIIString ) = factcheck (centroid, geom, expected)
104102test_centroid (" POINT(10 0)" , " POINT (10 0)" )
105103test_centroid (" LINESTRING(0 0, 10 0)" , " POINT (5 0)" )
106104test_centroid (" POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))" , " POINT (5 5)" )
107105test_centroid (" LINESTRING EMPTY" , " POINT EMPTY" )
108106
109107# GEOSIntersectionTest
110- test_intersection (g1:: ASCIIString , g2:: ASCIIString , expected:: ASCIIString ) = factcheck (intersection, g1, g2, expected)
108+ test_intersection (g1:: Compat. ASCIIString , g2:: Compat. ASCIIString , expected:: Compat. ASCIIString ) = factcheck (intersection, g1, g2, expected)
111109test_intersection (" POLYGON EMPTY" , " POLYGON EMPTY" , " GEOMETRYCOLLECTION EMPTY" )
112110test_intersection (" POLYGON((1 1,1 5,5 5,5 1,1 1))" , " POINT(2 2)" , " POINT(2 2)" )
113111test_intersection (" MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))" , " POLYGON((-1 1,-1 2,2 2,2 1,-1 1))" , " POLYGON ((0 1, 0 2, 2 2, 2 1, 0 1))" )
@@ -116,7 +114,7 @@ test_intersection("MULTIPOLYGON(((0 0,5 10,10 0,0 0),(1 1,1 2,2 2,2 1,1 1),(100
116114 " GEOMETRYCOLLECTION (LINESTRING (1 2, 2 2), LINESTRING (2 1, 1 1), POLYGON ((0.5 1, 1 2, 1 1, 0.5 1)), POLYGON ((9 2, 9.5 1, 2 1, 2 2, 9 2)))" )
117115
118116# GEOSIntersectsTest
119- test_intersects (g1:: ASCIIString , g2:: ASCIIString , expected:: Bool ) = factcheck (intersects, g1, g2, false )
117+ test_intersects (g1:: Compat. ASCIIString , g2:: Compat. ASCIIString , expected:: Bool ) = factcheck (intersects, g1, g2, false )
120118test_intersects (" POLYGON EMPTY" , " POLYGON EMPTY" , false )
121119test_intersects (" POLYGON((1 1,1 5,5 5,5 1,1 1))" , " POINT(2 2)" , true )
122120test_intersects (" POINT(2 2)" , " POLYGON((1 1,1 5,5 5,5 1,1 1))" , true )
@@ -158,7 +156,7 @@ LibGEOS.normalize!(g1)
158156equivalent_to_wkt (g1, " MULTILINESTRING ((2 0, 4 0), (0 0, 2 0))" )
159157
160158# GEOSPointOnSurfaceTest
161- test_pointonsurface (geom:: ASCIIString , expected:: ASCIIString ) = factcheck (pointOnSurface, geom, expected)
159+ test_pointonsurface (geom:: Compat. ASCIIString , expected:: Compat. ASCIIString ) = factcheck (pointOnSurface, geom, expected)
162160test_pointonsurface (" POINT(10 0)" , " POINT (10 0)" )
163161test_pointonsurface (" LINESTRING(0 0, 5 0, 10 0)" , " POINT (5 0)" )
164162test_pointonsurface (" POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))" , " POINT (5 5)" )
@@ -194,7 +192,7 @@ equivalent_to_wkt(simplify(g1, 0.0), "POLYGON EMPTY")
194192@fact equals (g1, topologyPreserveSimplify (g1, 43.2 )) --> true
195193
196194# GEOSSnapTest
197- function test_snap (g1:: ASCIIString , g2:: ASCIIString , expected:: ASCIIString , tol:: Float64 = 0.0 )
195+ function test_snap (g1:: Compat. ASCIIString , g2:: Compat. ASCIIString , expected:: Compat. ASCIIString , tol:: Float64 = 0.0 )
198196 equivalent_to_wkt (snap (parseWKT (g1), parseWKT (g2), tol), expected)
199197end
200198test_snap (" POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))" , " POINT(0.5 0)" ,
@@ -219,7 +217,7 @@ test_snap("LINESTRING(-71.1317 42.2511,-71.1317 42.2509)", "MULTIPOINT(-71.1261
219217 " LINESTRING (-71.1257 42.2703, -71.1261 42.2703, -71.1261 42.2702, -71.1317 42.2509)" , .5 )
220218
221219# GEOSUnaryUnionTest
222- test_unaryunion (geom:: ASCIIString , expected:: ASCIIString ) = factcheck (unaryUnion, geom, expected)
220+ test_unaryunion (geom:: Compat. ASCIIString , expected:: Compat. ASCIIString ) = factcheck (unaryUnion, geom, expected)
223221test_unaryunion (" POINT EMPTY" , " GEOMETRYCOLLECTION EMPTY" )
224222test_unaryunion (" POINT (6 3)" , " POINT (6 3)" )
225223test_unaryunion (" POINT (4 5 6)" , " POINT Z (4 5 6)" )
@@ -234,7 +232,7 @@ test_unaryunion("GEOMETRYCOLLECTION (MULTILINESTRING((5 7, 12 7), (4 5, 6 5), (5
234232 " GEOMETRYCOLLECTION (POINT (6 6.5), POINT (12 2), LINESTRING (5 7, 7 7), LINESTRING (10 7, 12 7), LINESTRING (5.5 7.5, 6.5 7.5), POLYGON ((10 7, 10 0, 0 0, 0 10, 10 10, 10 7), (5 6, 7 6, 7 7, 7 8, 5 8, 5 7, 5 6)))" )
235233
236234# GEOSWithinTest
237- test_within (g1:: ASCIIString , g2:: ASCIIString , expected:: Bool ) = factcheck (within, g1, g2, expected)
235+ test_within (g1:: Compat. ASCIIString , g2:: Compat. ASCIIString , expected:: Bool ) = factcheck (within, g1, g2, expected)
238236test_within (" POLYGON EMPTY" , " POLYGON EMPTY" , false )
239237test_within (" POLYGON((1 1,1 5,5 5,5 1,1 1))" , " POINT(2 2)" , false )
240238test_within (" POINT(2 2)" , " POLYGON((1 1,1 5,5 5,5 1,1 1))" , true )
0 commit comments