func TestComplete_LandusageToWaterarea1(t *testing.T) { // Parks inserted into landusages cache := ts.cache(t) defer cache.Close() assertCachedWay(t, cache, 11001) assertCachedWay(t, cache, 12001) assertCachedWay(t, cache, 13001) assertRecords(t, []checkElem{ {"osm_waterareas", 11001, Missing, nil}, {"osm_waterareas", -12001, Missing, nil}, {"osm_waterareas", -13001, Missing, nil}, {"osm_waterareas_gen0", 11001, Missing, nil}, {"osm_waterareas_gen0", -12001, Missing, nil}, {"osm_waterareas_gen0", -13001, Missing, nil}, {"osm_waterareas_gen1", 11001, Missing, nil}, {"osm_waterareas_gen1", -12001, Missing, nil}, {"osm_waterareas_gen1", -13001, Missing, nil}, {"osm_landusages", 11001, "park", nil}, {"osm_landusages", -12001, "park", nil}, {"osm_landusages", -13001, "park", nil}, {"osm_landusages_gen0", 11001, "park", nil}, {"osm_landusages_gen0", -12001, "park", nil}, {"osm_landusages_gen0", -13001, "park", nil}, {"osm_landusages_gen1", 11001, "park", nil}, {"osm_landusages_gen1", -12001, "park", nil}, {"osm_landusages_gen1", -13001, "park", nil}, }) }
func TestComplete_MergeOuterMultipolygonWay2(t *testing.T) { // Merged outer way of multipolygon was inserted diffCache := ts.diffCache(t) defer diffCache.Close() if ids := diffCache.Ways.Get(16001); len(ids) != 1 || ids[0] != 16001 { t.Error("way does not references relation") } if ids := diffCache.Ways.Get(16002); len(ids) != 0 { t.Error("way references relation") } cache := ts.cache(t) defer cache.Close() rel, err := cache.Relations.GetRelation(16001) if err != nil { t.Fatal(err) } if len(rel.Members) != 2 || rel.Members[0].Id != 16001 || rel.Members[1].Id != 16011 { t.Error("unexpected relation members", rel) } assertRecords(t, []checkElem{ {"osm_landusages", 16001, Missing, nil}, {"osm_roads", 16002, Missing, nil}, }) assertGeomArea(t, checkElem{"osm_landusages", -16001, "park", nil}, 12779350582) }
func TestComplete_ChangedHoleTags2(t *testing.T) { // Newly tagged hole is inserted cache := ts.cache(t) defer cache.Close() assertCachedWay(t, cache, 14001) assertCachedWay(t, cache, 14011) assertGeomArea(t, checkElem{"osm_waterareas", 14011, "water", nil}, 26672019779) assertGeomArea(t, checkElem{"osm_landusages", -14001, "park", nil}, 10373697182) }
func TestComplete_ChangedHoleTags1(t *testing.T) { // Multipolygon relation with untagged hole cache := ts.cache(t) defer cache.Close() assertCachedWay(t, cache, 14001) assertCachedWay(t, cache, 14011) assertRecords(t, []checkElem{ {"osm_waterareas", 14011, Missing, nil}, {"osm_waterareas", -14011, Missing, nil}, {"osm_landusages", -14001, "park", nil}, }) }
func TestComplete_PartialDelete(t *testing.T) { // Deleted relation but nodes are still cached cache := ts.cache(t) defer cache.Close() assertCachedNode(t, cache, 2001) assertCachedWay(t, cache, 2001) assertCachedWay(t, cache, 2002) assertRecords(t, []checkElem{ {"osm_landusages", -2001, Missing, nil}, {"osm_landusages", 2001, Missing, nil}, }) }
func TestComplete_WayRelRefAfterDelete1(t *testing.T) { // Ways references relation cache := ts.diffCache(t) defer cache.Close() if ids := cache.Ways.Get(21001); len(ids) != 1 || ids[0] != 21001 { t.Error("way does not references relation") } assertRecords(t, []checkElem{ {"osm_roads", 21001, "residential", nil}, {"osm_landusages", -21001, "park", nil}, }) }
func TestComplete_NodeWayRefAfterDelete1(t *testing.T) { // Nodes references way cache := ts.diffCache(t) defer cache.Close() if ids := cache.Coords.Get(20001); len(ids) != 1 || ids[0] != 20001 { t.Error("node does not references way") } if ids := cache.Coords.Get(20002); len(ids) != 1 || ids[0] != 20001 { t.Error("node does not references way") } assertRecords(t, []checkElem{ {"osm_roads", 20001, "residential", nil}, {"osm_barrierpoints", 20001, "block", nil}, }) }