photoprism/internal/maps/olc_test.go
Michael Mayer 1e7c0c2435 Backend: Improve location hashing and categories
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2019-12-20 23:05:44 +01:00

31 lines
622 B
Go

package maps
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOlcEncode(t *testing.T) {
t.Run("Wildgehege", func(t *testing.T) {
plusCode := OlcEncode(48.56344833333333, 8.996878333333333)
expected := "8FWCHX7W+"
assert.Equal(t, expected, plusCode)
})
t.Run("LatOverflow", func(t *testing.T) {
plusCode := OlcEncode(548.56344833333333, 8.996878333333333)
expected := ""
assert.Equal(t, expected, plusCode)
})
t.Run("LongOverflow", func(t *testing.T) {
plusCode := OlcEncode(48.56344833333333, 258.996878333333333)
expected := ""
assert.Equal(t, expected, plusCode)
})
}