2021-05-31 15:40:52 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMarkers_Contains(t *testing.T) {
|
2021-09-01 20:46:15 +02:00
|
|
|
m1 := *NewMarker("ft8es39w45bnlqdw", "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 0.308333, 0.206944, 0.355556, 0.355556)
|
|
|
|
m2 := *NewMarker("ft8es39w45bnlqdw", "lt9k3pw1wowuy1c2", SrcImage, MarkerFace, 0.308313, 0.206914, 0.655556, 0.655556)
|
|
|
|
m3 := *NewMarker("ft8es39w45bnlqdw", "lt9k3pw1wowuy1c3", SrcImage, MarkerFace, 0.998133, 0.816944, 0.0001, 0.0001)
|
2021-05-31 15:40:52 +02:00
|
|
|
|
|
|
|
m := Markers{m1}
|
|
|
|
|
|
|
|
assert.True(t, m.Contains(m2))
|
|
|
|
assert.False(t, m.Contains(m3))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMarkers_FaceCount(t *testing.T) {
|
2021-09-01 20:46:15 +02:00
|
|
|
m1 := *NewMarker("ft8es39w45bnlqdw", "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 0.308333, 0.206944, 0.355556, 0.355556)
|
|
|
|
m2 := *NewMarker("ft8es39w45bnlqdw", "lt9k3pw1wowuy1c2", SrcImage, MarkerFace, 0.298133, 0.216944, 0.255556, 0.155556)
|
|
|
|
m3 := *NewMarker("ft8es39w45bnlqdw", "lt9k3pw1wowuy1c3", SrcImage, MarkerFace, 0.998133, 0.816944, 0.0001, 0.0001)
|
2021-05-31 15:40:52 +02:00
|
|
|
m3.MarkerInvalid = true
|
|
|
|
|
|
|
|
m := Markers{m1, m2, m3}
|
|
|
|
|
|
|
|
assert.Equal(t, 2, m.FaceCount())
|
|
|
|
}
|
2021-09-02 14:23:40 +02:00
|
|
|
|
|
|
|
func TestMarkers_SubjectNames(t *testing.T) {
|
|
|
|
m1 := MarkerFixtures.Get("1000003-3")
|
|
|
|
m2 := MarkerFixtures.Get("1000003-4")
|
|
|
|
m3 := MarkerFixtures.Get("1000003-5")
|
|
|
|
|
|
|
|
m1.MarkerInvalid = true
|
|
|
|
|
|
|
|
m := Markers{m1, m2, m3}
|
|
|
|
|
|
|
|
assert.Equal(t, []string{"Jens Mander", "Corn McCornface"}, m.SubjectNames())
|
|
|
|
}
|