Skip to content

Commit 50d1c3e

Browse files
authored
Merge pull request #1710 from joto/geom-assert-add
Add assertions so we are not using the wrong func by accident
2 parents 15ecf96 + e1fb98e commit 50d1c3e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tests/common-buffer.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ class test_buffer_t
2828

2929
osmium::Node const &add_node(std::string const &data)
3030
{
31+
assert(!data.empty() && data[0] == 'n');
3132
return m_buffer.get<osmium::Node>(add_opl(data));
3233
}
3334

3435
osmium::Way &add_way(std::string const &data)
3536
{
37+
assert(!data.empty() && data[0] == 'w');
3638
return m_buffer.get<osmium::Way>(add_opl(data));
3739
}
3840

@@ -52,6 +54,7 @@ class test_buffer_t
5254

5355
osmium::Relation const &add_relation(std::string const &data)
5456
{
57+
assert(!data.empty() && data[0] == 'r');
5558
return m_buffer.get<osmium::Relation>(add_opl(data));
5659
}
5760

tests/test-geom-lines.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ TEST_CASE("line geometry", "[NoDB]")
5151
TEST_CASE("create_linestring from OSM data", "[NoDB]")
5252
{
5353
test_buffer_t buffer;
54-
buffer.add_node("w20 Nn1x1y1,n2x2y2");
54+
buffer.add_way("w20 Nn1x1y1,n2x2y2");
5555

5656
auto const geom =
5757
geom::create_linestring(buffer.buffer().get<osmium::Way>(0));
@@ -68,7 +68,7 @@ TEST_CASE("create_linestring from OSM data", "[NoDB]")
6868
TEST_CASE("create_linestring from OSM data without locations", "[NoDB]")
6969
{
7070
test_buffer_t buffer;
71-
buffer.add_node("w20 Nn1,n2");
71+
buffer.add_way("w20 Nn1,n2");
7272

7373
auto const geom =
7474
geom::create_linestring(buffer.buffer().get<osmium::Way>(0));
@@ -79,7 +79,7 @@ TEST_CASE("create_linestring from OSM data without locations", "[NoDB]")
7979
TEST_CASE("create_linestring from invalid OSM data", "[NoDB]")
8080
{
8181
test_buffer_t buffer;
82-
buffer.add_node("w20 Nn1x1y1");
82+
buffer.add_way("w20 Nn1x1y1");
8383

8484
auto const geom =
8585
geom::create_linestring(buffer.buffer().get<osmium::Way>(0));

0 commit comments

Comments
 (0)