Add highway tests (#1294)

This PR adds unit tests for the transportation layer, and fixes several bugs in the unit testing code.  It verifies the correct zoom association to the various highway classes, and verifies that updates to highway attributes are populated.

Additionally, the documentation for unit tests in the CONTRIB guide is updated to note the specific make commands for developers to run.
This commit is contained in:
Brian Sperlongano
2021-11-11 02:27:01 -05:00
committed by GitHub
parent 26cfe69a9c
commit d7ea45349e
6 changed files with 177 additions and 6 deletions

View File

@@ -34,12 +34,12 @@ BEGIN
-- Test 300: Verify landuse modified
SELECT COUNT(*) INTO cnt FROM osm_landcover_polygon WHERE mapping_key='natural' AND subclass='scrub';
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(300, 'import', 'osm_landcover_polygon natural=scrub expected 1, got ' || cnt);
INSERT INTO omt_test_failures VALUES(300, 'update', 'osm_landcover_polygon natural=scrub expected 1, got ' || cnt);
END IF;
SELECT COUNT(*) INTO cnt FROM osm_landcover_polygon WHERE mapping_key='natural' AND subclass='wood';
IF cnt <> 0 THEN
INSERT INTO omt_test_failures VALUES(300, 'import', 'osm_landcover_polygon natural=wood expected 0, got ' || cnt);
INSERT INTO omt_test_failures VALUES(300, 'update', 'osm_landcover_polygon natural=wood expected 0, got ' || cnt);
END IF;
-- Test 400: Verify new city added
@@ -48,6 +48,19 @@ BEGIN
INSERT INTO omt_test_failures VALUES(400, 'update', 'osm_border_linestring city count expected 2, got ' || cnt);
END IF;
-- Test 500: Verify tags changed
SELECT COUNT(*) INTO cnt FROM osm_transportation_merge_linestring_gen_z9
WHERE is_tunnel = TRUE
AND is_bridge = FALSE
AND toll = FALSE
AND layer = -1
AND bicycle = 'yes'
AND foot = 'yes'
AND horse = 'yes';
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(500, 'update', 'osm_transportation_linestring z9 update tags expected 1, got ' || cnt);
END IF;
END;
$$;