Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeLonewolf committed Nov 18, 2021
1 parent 69a4166 commit 83ee059
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/import/500_import-highway.osm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
<nd ref="500071" />
<nd ref="500072" />
<tag k="highway" v="path"/>
<tag k="colour" v="red"/>
<tag k="name" v="OpenMapTiles Path z13"/>
</way>
<way id="5008" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
Expand All @@ -83,6 +82,12 @@
<tag k="name" v="OpenMapTiles Track z12"/>
</way>

<relation id="507" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" changeset="1" user="u" uid="1">
<member type="way" ref="5007" role=""/>
<tag k="type" v="route"/>
<tag k="route" v="hiking"/>
<tag k="colour" v="red"/>
</relation>
<relation id="508" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" changeset="1" user="u" uid="1">
<member type="way" ref="5008" role=""/>
<tag k="type" v="route"/>
Expand Down
14 changes: 14 additions & 0 deletions tests/test-post-import.sql
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ BEGIN
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_transportation_linestring z9 import tags expected 1, got ' || cnt);
END IF;

SELECT COUNT(*) INTO cnt FROM osm_transportation_name_linestring
WHERE tags->'name' = 'OpenMapTiles Path z13'
AND route_rank = 2;
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_transportation_name_linestring z13 route_rank expected 1, got ' || cnt);
END IF;

SELECT COUNT(*) INTO cnt FROM osm_transportation_name_linestring
WHERE tags->'name' = 'OpenMapTiles Track z12'
AND route_rank = 1;
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_transportation_name_linestring z12 route_rank expected 1, got ' || cnt);
END IF;

END;

$$
Expand Down

0 comments on commit 83ee059

Please sign in to comment.