2020-01-09 01:21:09 +01:00
|
|
|
package classify
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLabel_NewLocationLabel(t *testing.T) {
|
2021-02-21 17:18:36 +01:00
|
|
|
LocLabel := LocationLabel("locationtest", 23)
|
2020-01-09 01:21:09 +01:00
|
|
|
t.Log(LocLabel)
|
|
|
|
assert.Equal(t, "location", LocLabel.Source)
|
|
|
|
assert.Equal(t, 23, LocLabel.Uncertainty)
|
|
|
|
assert.Equal(t, "locationtest", LocLabel.Name)
|
|
|
|
|
|
|
|
t.Run("locationtest / slash", func(t *testing.T) {
|
2021-02-21 17:18:36 +01:00
|
|
|
LocLabel := LocationLabel("locationtest / slash", 24)
|
2020-01-09 01:21:09 +01:00
|
|
|
t.Log(LocLabel)
|
|
|
|
assert.Equal(t, "location", LocLabel.Source)
|
|
|
|
assert.Equal(t, 24, LocLabel.Uncertainty)
|
|
|
|
assert.Equal(t, "locationtest", LocLabel.Name)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("locationtest - minus", func(t *testing.T) {
|
2021-02-21 17:18:36 +01:00
|
|
|
LocLabel := LocationLabel("locationtest - minus", 80)
|
2020-01-09 01:21:09 +01:00
|
|
|
t.Log(LocLabel)
|
|
|
|
assert.Equal(t, "location", LocLabel.Source)
|
|
|
|
assert.Equal(t, 80, LocLabel.Uncertainty)
|
|
|
|
assert.Equal(t, "locationtest", LocLabel.Name)
|
|
|
|
})
|
|
|
|
}
|
2020-04-29 11:18:26 +02:00
|
|
|
|
|
|
|
func TestLabel_Title(t *testing.T) {
|
|
|
|
t.Run("locationtest123", func(t *testing.T) {
|
2021-02-21 17:18:36 +01:00
|
|
|
LocLabel := LocationLabel("locationtest123", 23)
|
2020-04-29 11:18:26 +02:00
|
|
|
assert.Equal(t, "Locationtest123", LocLabel.Title())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Berlin/Neukölln", func(t *testing.T) {
|
2021-02-21 17:18:36 +01:00
|
|
|
LocLabel := LocationLabel("berlin/neukölln_hasenheide", 23)
|
2020-06-01 11:23:15 +02:00
|
|
|
assert.Equal(t, "Berlin / Neukölln Hasenheide", LocLabel.Title())
|
2020-04-29 11:18:26 +02:00
|
|
|
})
|
|
|
|
}
|