2014-05-05 12:21:46 +04:00
|
|
|
package mapping
|
2013-12-16 19:54:42 +04:00
|
|
|
|
|
|
|
import (
|
2014-05-05 12:21:46 +04:00
|
|
|
"testing"
|
2015-01-05 11:52:13 +03:00
|
|
|
|
|
|
|
"github.com/omniscale/imposm3/element"
|
2013-12-16 19:54:42 +04:00
|
|
|
)
|
|
|
|
|
2014-05-05 12:21:46 +04:00
|
|
|
func BenchmarkTagMatch(b *testing.B) {
|
2015-11-20 17:03:08 +03:00
|
|
|
m, err := NewMapping("test_mapping.yml")
|
2014-05-05 12:21:46 +04:00
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
2017-05-12 15:52:20 +03:00
|
|
|
matcher := m.PolygonMatcher
|
2014-05-05 12:21:46 +04:00
|
|
|
for i := 0; i < b.N; i++ {
|
2014-06-19 13:51:15 +04:00
|
|
|
e := element.Relation{}
|
|
|
|
e.Tags = element.Tags{"landuse": "forest", "name": "Forest", "source": "bling", "tourism": "zoo"}
|
|
|
|
if m := matcher.MatchRelation(&e); len(m) != 1 {
|
2014-05-05 12:21:46 +04:00
|
|
|
b.Fatal(m)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|