refactor test names
parent
07a8726169
commit
d495ca4bf4
|
@ -19,7 +19,7 @@ import (
|
|||
|
||||
var ts importTestSuite
|
||||
|
||||
func TestPrepare(t *testing.T) {
|
||||
func TestComplete_Prepare(t *testing.T) {
|
||||
var err error
|
||||
|
||||
ts.dir, err = ioutil.TempDir("", "imposm3test")
|
||||
|
@ -41,7 +41,7 @@ func TestPrepare(t *testing.T) {
|
|||
ts.dropSchemas()
|
||||
}
|
||||
|
||||
func TestImport(t *testing.T) {
|
||||
func TestComplete_Import(t *testing.T) {
|
||||
if ts.tableExists(t, dbschemaImport, "osm_roads") != false {
|
||||
t.Fatalf("table osm_roads exists in schema %s", dbschemaImport)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func TestImport(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestDeploy(t *testing.T) {
|
||||
func TestComplete_Deploy(t *testing.T) {
|
||||
ts.deployOsm(t)
|
||||
if ts.tableExists(t, dbschemaImport, "osm_roads") != false {
|
||||
t.Fatalf("table osm_roads exists in schema %s", dbschemaImport)
|
||||
|
@ -61,7 +61,7 @@ func TestDeploy(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestLandusageToWaterarea1(t *testing.T) {
|
||||
func TestComplete_LandusageToWaterarea1(t *testing.T) {
|
||||
// Parks inserted into landusages
|
||||
cache := ts.cache(t)
|
||||
defer cache.Close()
|
||||
|
@ -96,7 +96,7 @@ func TestLandusageToWaterarea1(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestChangedHoleTags1(t *testing.T) {
|
||||
func TestComplete_ChangedHoleTags1(t *testing.T) {
|
||||
// Multipolygon relation with untagged hole
|
||||
cache := ts.cache(t)
|
||||
defer cache.Close()
|
||||
|
@ -110,7 +110,7 @@ func TestChangedHoleTags1(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestSplitOuterMultipolygonWay1(t *testing.T) {
|
||||
func TestComplete_SplitOuterMultipolygonWay1(t *testing.T) {
|
||||
// Single outer way of multipolygon was inserted.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_roads", 15002, Missing, nil},
|
||||
|
@ -119,7 +119,7 @@ func TestSplitOuterMultipolygonWay1(t *testing.T) {
|
|||
assertGeomArea(t, checkElem{"osm_landusages", -15001, "park", nil}, 9816216452)
|
||||
}
|
||||
|
||||
func TestMergeOuterMultipolygonWay1(t *testing.T) {
|
||||
func TestComplete_MergeOuterMultipolygonWay1(t *testing.T) {
|
||||
// Splitted outer way of multipolygon was inserted.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", -16001, "park", nil},
|
||||
|
@ -128,7 +128,7 @@ func TestMergeOuterMultipolygonWay1(t *testing.T) {
|
|||
assertGeomArea(t, checkElem{"osm_landusages", -16001, "park", nil}, 12779350582)
|
||||
}
|
||||
|
||||
func TestBrokenMultipolygonWays(t *testing.T) {
|
||||
func TestComplete_BrokenMultipolygonWays(t *testing.T) {
|
||||
// MultiPolygons with broken outer ways are handled.
|
||||
// outer way does not merge (17002 has one node)
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -145,7 +145,7 @@ func TestBrokenMultipolygonWays(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestNodeWayInsertedTwice(t *testing.T) {
|
||||
func TestComplete_NodeWayInsertedTwice(t *testing.T) {
|
||||
// Way with multiple mappings is inserted twice in same table
|
||||
rows := ts.queryRows(t, "osm_roads", 18001)
|
||||
if len(rows) != 2 || rows[0].osmType != "residential" || rows[1].osmType != "tram" {
|
||||
|
@ -153,7 +153,7 @@ func TestNodeWayInsertedTwice(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestOuterWayNotInserted(t *testing.T) {
|
||||
func TestComplete_OuterWayNotInserted(t *testing.T) {
|
||||
// Outer way with different tag is not inserted twice into same table
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", -19001, "farmland", nil},
|
||||
|
@ -162,7 +162,7 @@ func TestOuterWayNotInserted(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestOuterWayInserted(t *testing.T) {
|
||||
func TestComplete_OuterWayInserted(t *testing.T) {
|
||||
// Outer way with different tag is inserted twice into different table
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", 19101, "farm", nil},
|
||||
|
@ -171,7 +171,7 @@ func TestOuterWayInserted(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestNodeWayRefAfterDelete1(t *testing.T) {
|
||||
func TestComplete_NodeWayRefAfterDelete1(t *testing.T) {
|
||||
// Nodes references way
|
||||
|
||||
cache := ts.diffCache(t)
|
||||
|
@ -189,7 +189,7 @@ func TestNodeWayRefAfterDelete1(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestWayRelRefAfterDelete1(t *testing.T) {
|
||||
func TestComplete_WayRelRefAfterDelete1(t *testing.T) {
|
||||
// Ways references relation
|
||||
|
||||
cache := ts.diffCache(t)
|
||||
|
@ -204,7 +204,7 @@ func TestWayRelRefAfterDelete1(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationWayNotInserted(t *testing.T) {
|
||||
func TestComplete_RelationWayNotInserted(t *testing.T) {
|
||||
// Part of relation was inserted only once.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", -9001, "park", map[string]string{"name": "rel 9001"}},
|
||||
|
@ -215,7 +215,7 @@ func TestRelationWayNotInserted(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationWaysInserted(t *testing.T) {
|
||||
func TestComplete_RelationWaysInserted(t *testing.T) {
|
||||
// Outer ways of multipolygon are inserted.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", -9201, "park", map[string]string{"name": "9209"}},
|
||||
|
@ -233,7 +233,7 @@ func TestRelationWaysInserted(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func TestRelationWayInserted(t *testing.T) {
|
||||
func TestComplete_RelationWayInserted(t *testing.T) {
|
||||
// Part of relation was inserted twice.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", -8001, "park", map[string]string{"name": "rel 8001"}},
|
||||
|
@ -241,7 +241,7 @@ func TestRelationWayInserted(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestSingleNodeWaysNotInserted(t *testing.T) {
|
||||
func TestComplete_SingleNodeWaysNotInserted(t *testing.T) {
|
||||
// Ways with single/duplicate nodes are not inserted.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", 30001, Missing, nil},
|
||||
|
@ -250,12 +250,12 @@ func TestSingleNodeWaysNotInserted(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestPolygonWithDuplicateNodesIsValid(t *testing.T) {
|
||||
func TestComplete_PolygonWithDuplicateNodesIsValid(t *testing.T) {
|
||||
// Polygon with duplicate nodes is valid.
|
||||
assertGeomValid(t, checkElem{"osm_landusages", 30005, "park", nil})
|
||||
}
|
||||
|
||||
func TestIncompletePolygons(t *testing.T) {
|
||||
func TestComplete_IncompletePolygons(t *testing.T) {
|
||||
// Non-closed/incomplete polygons are not inserted.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -264,7 +264,7 @@ func TestIncompletePolygons(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestResidentialToSecondary(t *testing.T) {
|
||||
func TestComplete_ResidentialToSecondary(t *testing.T) {
|
||||
// Residential road is not in roads_gen0/1.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -274,7 +274,7 @@ func TestResidentialToSecondary(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationBeforeRemove(t *testing.T) {
|
||||
func TestComplete_RelationBeforeRemove(t *testing.T) {
|
||||
// Relation and way is inserted.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -283,7 +283,7 @@ func TestRelationBeforeRemove(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationWithoutTags(t *testing.T) {
|
||||
func TestComplete_RelationWithoutTags(t *testing.T) {
|
||||
// Relation without tags is inserted.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -292,7 +292,7 @@ func TestRelationWithoutTags(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestDuplicateIds(t *testing.T) {
|
||||
func TestComplete_DuplicateIds(t *testing.T) {
|
||||
// Relation/way with same ID is inserted.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -303,13 +303,13 @@ func TestDuplicateIds(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationUpdatedByNode(t *testing.T) {
|
||||
func TestComplete_RelationUpdatedByNode(t *testing.T) {
|
||||
// Relations was updated after modified node.
|
||||
|
||||
assertGeomArea(t, checkElem{"osm_buildings", -52121, "yes", nil}, 13653930440.868315)
|
||||
}
|
||||
|
||||
func TestGeneralizedBananaPolygonIsValid(t *testing.T) {
|
||||
func TestComplete_GeneralizedBananaPolygonIsValid(t *testing.T) {
|
||||
// Generalized polygons are valid.
|
||||
|
||||
assertGeomValid(t, checkElem{"osm_landusages", 7101, Missing, nil})
|
||||
|
@ -318,7 +318,7 @@ func TestGeneralizedBananaPolygonIsValid(t *testing.T) {
|
|||
assertGeomValid(t, checkElem{"osm_landusages_gen1", 7101, Missing, nil})
|
||||
}
|
||||
|
||||
func TestGeneralizedLinestringIsValid(t *testing.T) {
|
||||
func TestComplete_GeneralizedLinestringIsValid(t *testing.T) {
|
||||
// Generalized linestring is valid.
|
||||
|
||||
// geometry is not simple, but valid
|
||||
|
@ -331,23 +331,23 @@ func TestGeneralizedLinestringIsValid(t *testing.T) {
|
|||
assertGeomLength(t, checkElem{"osm_roads_gen1", 7201, "primary", nil}, 1243660.044819)
|
||||
}
|
||||
|
||||
func TestRingWithGap(t *testing.T) {
|
||||
func TestComplete_RingWithGap(t *testing.T) {
|
||||
// Multipolygon and way with gap (overlapping but different endpoints) gets closed
|
||||
assertGeomValid(t, checkElem{"osm_landusages", -7301, Missing, nil})
|
||||
assertGeomValid(t, checkElem{"osm_landusages", 7311, Missing, nil})
|
||||
}
|
||||
|
||||
func TestMultipolygonWithOpenRing(t *testing.T) {
|
||||
func TestComplete_MultipolygonWithOpenRing(t *testing.T) {
|
||||
// Multipolygon is inserted even if there is an open ring/member
|
||||
assertGeomValid(t, checkElem{"osm_landusages", -7401, Missing, nil})
|
||||
}
|
||||
|
||||
func TestUpdatedNodes1(t *testing.T) {
|
||||
func TestComplete_UpdatedNodes1(t *testing.T) {
|
||||
// Zig-Zag line is inserted.
|
||||
assertGeomLength(t, checkElem{"osm_roads", 60000, Missing, nil}, 14035.61150207768)
|
||||
}
|
||||
|
||||
func TestUpdateNodeToCoord1(t *testing.T) {
|
||||
func TestComplete_UpdateNodeToCoord1(t *testing.T) {
|
||||
// Node is inserted with tag.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_amenities", 70001, "police", nil},
|
||||
|
@ -355,7 +355,7 @@ func TestUpdateNodeToCoord1(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestEnumerateKey(t *testing.T) {
|
||||
func TestComplete_EnumerateKey(t *testing.T) {
|
||||
// Enumerate from key.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_landusages", 100001, "park", map[string]string{"enum": "1"}},
|
||||
|
@ -364,11 +364,11 @@ func TestEnumerateKey(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
func TestComplete_Update(t *testing.T) {
|
||||
ts.updateOsm(t, "./build/complete_db.osc.gz")
|
||||
}
|
||||
|
||||
func TestNoDuplicates(t *testing.T) {
|
||||
func TestComplete_NoDuplicates(t *testing.T) {
|
||||
// Relations/ways are only inserted once Checks #66
|
||||
|
||||
for _, table := range []string{"osm_roads", "osm_landusages"} {
|
||||
|
@ -395,7 +395,7 @@ func TestNoDuplicates(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestUpdatedLandusage(t *testing.T) {
|
||||
func TestComplete_UpdatedLandusage(t *testing.T) {
|
||||
// Multipolygon relation was modified
|
||||
|
||||
nd := element.Node{Long: 13.4, Lat: 47.5}
|
||||
|
@ -411,7 +411,7 @@ func TestUpdatedLandusage(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestPartialDelete(t *testing.T) {
|
||||
func TestComplete_PartialDelete(t *testing.T) {
|
||||
// Deleted relation but nodes are still cached
|
||||
|
||||
cache := ts.cache(t)
|
||||
|
@ -426,7 +426,7 @@ func TestPartialDelete(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestUpdatedNodes(t *testing.T) {
|
||||
func TestComplete_UpdatedNodes(t *testing.T) {
|
||||
// Nodes were added, modified or deleted
|
||||
|
||||
c := ts.cache(t)
|
||||
|
@ -441,7 +441,7 @@ func TestUpdatedNodes(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestLandusageToWaterarea2(t *testing.T) {
|
||||
func TestComplete_LandusageToWaterarea2(t *testing.T) {
|
||||
// Parks converted to water moved from landusages to waterareas
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -471,7 +471,7 @@ func TestLandusageToWaterarea2(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestChangedHoleTags2(t *testing.T) {
|
||||
func TestComplete_ChangedHoleTags2(t *testing.T) {
|
||||
// Newly tagged hole is inserted
|
||||
|
||||
cache := ts.cache(t)
|
||||
|
@ -483,7 +483,7 @@ func TestChangedHoleTags2(t *testing.T) {
|
|||
assertGeomArea(t, checkElem{"osm_landusages", -14001, "park", nil}, 10373697182)
|
||||
}
|
||||
|
||||
func TestSplitOuterMultipolygonWay2(t *testing.T) {
|
||||
func TestComplete_SplitOuterMultipolygonWay2(t *testing.T) {
|
||||
// Splitted outer way of multipolygon was inserted
|
||||
|
||||
diffCache := ts.diffCache(t)
|
||||
|
@ -502,7 +502,7 @@ func TestSplitOuterMultipolygonWay2(t *testing.T) {
|
|||
assertGeomArea(t, checkElem{"osm_landusages", -15001, "park", nil}, 9816216452)
|
||||
}
|
||||
|
||||
func TestMergeOuterMultipolygonWay2(t *testing.T) {
|
||||
func TestComplete_MergeOuterMultipolygonWay2(t *testing.T) {
|
||||
// Merged outer way of multipolygon was inserted
|
||||
|
||||
diffCache := ts.diffCache(t)
|
||||
|
@ -531,7 +531,7 @@ func TestMergeOuterMultipolygonWay2(t *testing.T) {
|
|||
assertGeomArea(t, checkElem{"osm_landusages", -16001, "park", nil}, 12779350582)
|
||||
}
|
||||
|
||||
func TestNodeWayRefAfterDelete2(t *testing.T) {
|
||||
func TestComplete_NodeWayRefAfterDelete2(t *testing.T) {
|
||||
// Node does not referece deleted way
|
||||
|
||||
diffCache := ts.diffCache(t)
|
||||
|
@ -552,7 +552,7 @@ func TestNodeWayRefAfterDelete2(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestWayRelRefAfterDelete2(t *testing.T) {
|
||||
func TestComplete_WayRelRefAfterDelete2(t *testing.T) {
|
||||
// Way does not referece deleted relation
|
||||
|
||||
diffCache := ts.diffCache(t)
|
||||
|
@ -568,7 +568,7 @@ func TestWayRelRefAfterDelete2(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestResidentialToSecondary2(t *testing.T) {
|
||||
func TestComplete_ResidentialToSecondary2(t *testing.T) {
|
||||
// New secondary (from residential) is now in roads_gen0/1.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -578,7 +578,7 @@ func TestResidentialToSecondary2(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationAfterRemove(t *testing.T) {
|
||||
func TestComplete_RelationAfterRemove(t *testing.T) {
|
||||
// Relation is deleted and way is still present.
|
||||
assertRecords(t, []checkElem{
|
||||
{"osm_buildings", 50011, "yes", nil},
|
||||
|
@ -587,7 +587,7 @@ func TestRelationAfterRemove(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationWithoutTags2(t *testing.T) {
|
||||
func TestComplete_RelationWithoutTags2(t *testing.T) {
|
||||
// Relation without tags is removed.
|
||||
|
||||
c := ts.cache(t)
|
||||
|
@ -606,7 +606,7 @@ func TestRelationWithoutTags2(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestDuplicateIds2(t *testing.T) {
|
||||
func TestComplete_DuplicateIds2(t *testing.T) {
|
||||
// Only relation/way with same ID was deleted.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -617,20 +617,20 @@ func TestDuplicateIds2(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRelationUpdatedByNode2(t *testing.T) {
|
||||
func TestComplete_RelationUpdatedByNode2(t *testing.T) {
|
||||
// Relations was updated after modified node.
|
||||
|
||||
assertGeomArea(t, checkElem{"osm_buildings", -52121, "yes", nil}, 16276875196.653734)
|
||||
}
|
||||
|
||||
func TestUpdatedWay2(t *testing.T) {
|
||||
func TestComplete_UpdatedWay2(t *testing.T) {
|
||||
// All nodes of straightened way are updated.
|
||||
|
||||
// new length 0.1 degree
|
||||
assertGeomLength(t, checkElem{"osm_roads", 60000, "park", nil}, 20037508.342789244/180.0/10.0)
|
||||
}
|
||||
|
||||
func TestUpdateNodeToCoord2(t *testing.T) {
|
||||
func TestComplete_UpdateNodeToCoord2(t *testing.T) {
|
||||
// Node is becomes coord after tags are removed.
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -639,7 +639,7 @@ func TestUpdateNodeToCoord2(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestNoDuplicateInsert(t *testing.T) {
|
||||
func TestComplete_NoDuplicateInsert(t *testing.T) {
|
||||
// Relation is not inserted again if a nother relation with the same way was modified
|
||||
// Checks #65
|
||||
|
||||
|
@ -650,7 +650,7 @@ func TestNoDuplicateInsert(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestUnsupportedRelation(t *testing.T) {
|
||||
func TestComplete_UnsupportedRelation(t *testing.T) {
|
||||
// Unsupported relation type is not inserted with update
|
||||
|
||||
assertRecords(t, []checkElem{
|
||||
|
@ -661,7 +661,7 @@ func TestUnsupportedRelation(t *testing.T) {
|
|||
|
||||
// #######################################################################
|
||||
|
||||
func TestDeployRevert(t *testing.T) {
|
||||
func TestComplete_DeployRevert(t *testing.T) {
|
||||
if ts.tableExists(t, dbschemaImport, "osm_roads") {
|
||||
t.Fatalf("table osm_roads exists in schema %s", dbschemaImport)
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ func TestDeployRevert(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestRemoveBackup(t *testing.T) {
|
||||
func TestComplete_RemoveBackup(t *testing.T) {
|
||||
if !ts.tableExists(t, dbschemaImport, "osm_roads") {
|
||||
t.Fatalf("table osm_roads does not exists in schema %s", dbschemaImport)
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ func TestRemoveBackup(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCleanup(t *testing.T) {
|
||||
func TestComplete_Cleanup(t *testing.T) {
|
||||
ts.dropSchemas()
|
||||
if err := os.RemoveAll(ts.dir); err != nil {
|
||||
t.Error(err)
|
||||
|
|
Loading…
Reference in New Issue