Skip to content

Commit 44b1201

Browse files
committed
Extend bbox test to mercator projection
1 parent 787a306 commit 44b1201

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

tests/test-output-flex-bbox.cpp

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
static testing::db::import_t db;
77

8-
TEST_CASE("bbox on nodes and ways")
8+
static char const *const conf_file = "test_output_flex_bbox.lua";
9+
10+
TEST_CASE("bbox on nodes and ways in 4326")
911
{
10-
testing::opt_t options = testing::opt_t()
11-
.flex("test_output_flex_bbox.lua")
12-
.srs(PROJ_LATLONG);
12+
options_t const options =
13+
testing::opt_t().flex(conf_file).srs(PROJ_LATLONG);
1314

1415
REQUIRE_NOTHROW(db.run_import(options,
1516
"n10 v1 dV Ta=b x10.0 y10.0\n"
@@ -41,3 +42,29 @@ TEST_CASE("bbox on nodes and ways")
4142
"abs(max_x - 10.2) < 0.01 AND abs(max_y - 10.2) < 0.01"));
4243
}
4344

45+
TEST_CASE("bbox on nodes and ways in 3857")
46+
{
47+
options_t const options = testing::opt_t().flex(conf_file);
48+
49+
REQUIRE_NOTHROW(db.run_import(options,
50+
"n10 v1 dV Ta=b x10.0 y10.0\n"
51+
"n11 v1 dV Ta=b x10.0 y10.2\n"
52+
"n12 v1 dV Ta=b x10.2 y10.2\n"
53+
"w20 v1 dV Thighway=primary Nn10,n11,n12\n"));
54+
55+
auto conn = db.db().connect();
56+
57+
CHECK(3 == conn.get_count("osm2pgsql_test_points"));
58+
59+
CHECK(1 == conn.get_count(
60+
"osm2pgsql_test_points",
61+
"abs(min_x - 10.0) < 0.01 AND abs(min_y - 10.0) < 0.01 AND "
62+
"abs(max_x - 10.0) < 0.01 AND abs(max_y - 10.0) < 0.01"));
63+
64+
CHECK(1 == conn.get_count("osm2pgsql_test_highways"));
65+
66+
CHECK(1 == conn.get_count(
67+
"osm2pgsql_test_highways",
68+
"abs(min_x - 10.0) < 0.01 AND abs(min_y - 10.0) < 0.01 AND "
69+
"abs(max_x - 10.2) < 0.01 AND abs(max_y - 10.2) < 0.01"));
70+
}

0 commit comments

Comments
 (0)