Skip to content

Commit 330e2cf

Browse files
committed
Add some tests for the single node in way case
1 parent f93b084 commit 330e2cf

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

tests/bdd/flex/geometry-collection.feature

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,25 @@ Feature: Create geometry collections from relations
6969
When running osm2pgsql flex
7070

7171
Then table osm2pgsql_test_collection contains exactly
72-
| osm_id | name | ST_GeometryType(geom) |
73-
| 30 | foo | NULL |
74-
| 31 | bar | NULL |
75-
| 32 | baz | NULL |
72+
| osm_id | name | geom |
73+
| 30 | foo | NULL |
74+
| 31 | bar | NULL |
75+
| 32 | baz | NULL |
76+
77+
Scenario: Null geometry generated for broken way lines
78+
Given the grid
79+
| 10 |
80+
And the OSM data
81+
"""
82+
w20 Nn10
83+
w21 Nn10,n10
84+
r30 Tname=w20 Mw20@
85+
r31 Tname=w21 Mw21@
86+
"""
87+
When running osm2pgsql flex
88+
89+
Then table osm2pgsql_test_collection contains exactly
90+
| osm_id | name | geom |
91+
| 30 | w20 | NULL |
92+
| 31 | w21 | NULL |
7693

tests/test-geom-collections.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,13 @@ TEST_CASE("create_collection from no OSM data returns null geometry", "[NoDB]")
8181
REQUIRE(geometry_type(geom) == "NULL");
8282
REQUIRE(num_geometries(geom) == 0);
8383
}
84+
85+
TEST_CASE("create_collection from OSM data with single-node way", "[NoDB]")
86+
{
87+
test_buffer_t buffer;
88+
buffer.add_way("w20 Nn1x1y1");
89+
90+
auto const geom = geom::create_collection(buffer.buffer());
91+
92+
REQUIRE(geom.is_null());
93+
}

0 commit comments

Comments
 (0)