Skip to content

Commit

Permalink
Add test after fixing #134
Browse files Browse the repository at this point in the history
  • Loading branch information
carlopi committed Oct 1, 2023
1 parent 0aeea41 commit 457675f
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions test/sql/geometry/st_area.test
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,37 @@ SELECT ST_Area(b) FROM (VALUES
40
100.0

# Test ST_Area for POLYGON_2D
# Test ST_Area for POLYGON_2D, also with holes
query I
SELECT ST_Area(p) FROM (VALUES
(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')::POLYGON_2D),
(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))')::POLYGON_2D)
(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))')::POLYGON_2D),
(ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0), (0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))')::POLYGON_2D),
(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.2 0.2, 0.2 0.8, 0.8 0.8, 0.8 0.2, 0.2 0.2))')::POLYGON_2D),
(ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0), (0.2 0.2, 0.2 0.8, 0.8 0.8, 0.8 0.2, 0.2 0.2))')::POLYGON_2D)
) as t(p);
----
1
0.64
0.64
0.64
0.64

# Test ST_Area for GEOMETRY, with holes
query I
SELECT ST_Area(p) FROM (VALUES
(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')),
(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))')),
(ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0), (0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))')),
(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.2 0.2, 0.2 0.8, 0.8 0.8, 0.8 0.2, 0.2 0.2))')),
(ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0), (0.2 0.2, 0.2 0.8, 0.8 0.8, 0.8 0.2, 0.2 0.2))'))
) as t(p);
----
1
0.64
0.64
0.64
0.64

# Test ST_Area for POINT_2D
query I
Expand All @@ -111,4 +133,4 @@ SELECT ST_Area(l) FROM (VALUES
query I
SELECT ST_AREA(ST_GeomFromText('POLYGON ((-82.03623 29.60482, -82.0357 29.605, -82.03526 29.60513, -82.03623 29.60482))'))
----
5.150000001635108e-09
5.150000001635108e-09

0 comments on commit 457675f

Please sign in to comment.