[Tile-serving] [openstreetmap/osm2pgsql] Add more way tests for flex output (#1249)
Sarah Hoffmann
notifications at github.com
Wed Jul 8 20:22:34 UTC 2020
@lonvia commented on this pull request.
> + "r30 v1 dV Tt=ag Mw10 at mark,w11@,w12 at mark,w13@,w14 at mark"});
+
+ REQUIRE_NOTHROW(db.run_import(options, data()));
+
+ auto conn = db.db().connect();
+
+ CHECK(1 == conn.get_count("osm2pgsql_test_t1"));
+ CHECK(1 == conn.get_count("osm2pgsql_test_t2"));
+ CHECK(3 == conn.get_count("osm2pgsql_test_tboth"));
+ CHECK(1 == conn.get_count("osm2pgsql_test_tboth",
+ "way_id = 10 AND rel_ids = '{30}'"));
+
+ options.append = true;
+
+ REQUIRE_NOTHROW(db.run_import(
+ options, "r30 v2 dV Tt=ag Mw10@,w11@,w12 at mark,w13@,w14 at mark"));
That boils to a relation change. Should already be covered by the relation change tests and can be removed here.
> + "r30 v1 dV Tt=ag Mw10@,w11@,w12 at mark,w13@,w14 at mark"});
+
+ REQUIRE_NOTHROW(db.run_import(options, data()));
+
+ auto conn = db.db().connect();
+
+ CHECK(1 == conn.get_count("osm2pgsql_test_t1"));
+ CHECK(1 == conn.get_count("osm2pgsql_test_t2"));
+ CHECK(3 == conn.get_count("osm2pgsql_test_tboth"));
+ CHECK(1 == conn.get_count("osm2pgsql_test_tboth",
+ "way_id = 10 AND rel_ids IS NULL"));
+
+ options.append = true;
+
+ REQUIRE_NOTHROW(db.run_import(
+ options, "r30 v2 dV Tt=ag Mw10 at mark,w11@,w12 at mark,w13@,w14 at mark"));
dto
> + SECTION("change node list to make way invalid")
+ {
+ REQUIRE_NOTHROW(
+ db.run_import(options, "w10 v2 dV Tt1=yes,t2=yes,tboth=yes Nn10"));
+ }
+
+ SECTION("change node to make way invalid (n11 same location as n10)")
+ {
+ REQUIRE_NOTHROW(db.run_import(options, "n11 v2 dV x10.0 y10.0"));
+ }
+
+ CHECK(1 == conn.get_count("osm2pgsql_test_t1"));
+ CHECK(1 == conn.get_count("osm2pgsql_test_t2"));
+ CHECK(2 == conn.get_count("osm2pgsql_test_tboth"));
+ CHECK(0 == conn.get_count("osm2pgsql_test_tboth",
+ "way_id = 10 AND rel_ids = '{30}'"));
Test for "way_id = 10" only, it's broader.
> +{
+ options_t options = testing::opt_t().slim().flex(conf_file);
+
+ testing::data_t data{tdata};
+ data.add({"w10 v1 dV Tt1=yes,t2=yes,tboth=yes Nn10",
+ "r30 v1 dV Tt=ag Mw10 at mark,w11@,w12 at mark,w13@,w14 at mark"});
+
+ REQUIRE_NOTHROW(db.run_import(options, data()));
+
+ auto conn = db.db().connect();
+
+ CHECK(1 == conn.get_count("osm2pgsql_test_t1"));
+ CHECK(1 == conn.get_count("osm2pgsql_test_t2"));
+ CHECK(2 == conn.get_count("osm2pgsql_test_tboth"));
+ CHECK(0 == conn.get_count("osm2pgsql_test_tboth",
+ "way_id = 10 AND rel_ids = '{30}'"));
dto
> +}
+
+TEST_CASE("change invalid geom to valid geom")
+{
+ options_t options = testing::opt_t().slim().flex(conf_file);
+
+ testing::data_t data{tdata};
+ data.add({"w10 v1 dV Tt1=yes,t2=yes,tboth=yes Nn10",
+ "r30 v1 dV Tt=ag Mw10 at mark,w11@,w12 at mark,w13@,w14 at mark"});
+
+ REQUIRE_NOTHROW(db.run_import(options, data()));
+
+ auto conn = db.db().connect();
+
+ CHECK(1 == conn.get_count("osm2pgsql_test_t1"));
+ CHECK(1 == conn.get_count("osm2pgsql_test_t2"));
General comment on T2 checks: I'm not convinced the test is sufficient. We should test that for all ways we have the right relations.
> + "n14 v1 dV x10.2 y10.0",
+ "n15 v1 dV x10.2 y10.1",
+ "n16 v1 dV x10.3 y10.0",
+ "n17 v1 dV x10.3 y10.1",
+ "n18 v1 dV x10.4 y10.0",
+ "n19 v1 dV x10.4 y10.1",
+ "w11 v1 dV Tt1=yes Nn12,n13",
+ "w12 v1 dV Tt2=yes Nn14,n15",
+ "w13 v1 dV Ttboth=yes Nn16,n17",
+ "w14 v1 dV Ttboth=yes Nn18,n19",
+ "w15 v1 dV Tt=ag Nn17,n19",
+ "r30 v1 dV Tt=ag Mw10@,w11@,w12 at mark,w13@,w14 at mark"};
+
+// adding relation (marked)
+
+TEST_CASE("test way: add relation with way in t1 (marked)")
Comment should reflect that we are testing relation change as well.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1249#pullrequestreview-445088875
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20200708/2129ca1b/attachment.htm>
More information about the Tile-serving
mailing list