-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarker_test.go
45 lines (36 loc) · 1.77 KB
/
marker_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package markers
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestMarkerValues_AllMarkers(t *testing.T) {
markerValues := make(MarkerValues)
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest1")
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest2")
markerValues["anyMarker2"] = append(markerValues["anyMarker2"], "anyTest3")
assert.Equal(t, []interface{}{"anyTest1", "anyTest2"}, markerValues.AllMarkers("anyMarker1"))
assert.Equal(t, []interface{}{"anyTest3"}, markerValues.AllMarkers("anyMarker2"))
}
func TestMarkerValues_Count(t *testing.T) {
markerValues := make(MarkerValues)
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest1")
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest2")
markerValues["anyMarker2"] = append(markerValues["anyMarker2"], "anyTest3")
assert.Equal(t, 3, markerValues.Count())
}
func TestMarkerValues_CountByName(t *testing.T) {
markerValues := make(MarkerValues)
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest1")
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest2")
markerValues["anyMarker2"] = append(markerValues["anyMarker2"], "anyTest3")
assert.Equal(t, 2, markerValues.CountByName("anyMarker1"))
assert.Equal(t, 1, markerValues.CountByName("anyMarker2"))
}
func TestMarkerValues_First(t *testing.T) {
markerValues := make(MarkerValues)
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest1")
markerValues["anyMarker1"] = append(markerValues["anyMarker1"], "anyTest2")
markerValues["anyMarker2"] = append(markerValues["anyMarker2"], "anyTest3")
assert.Equal(t, "anyTest1", markerValues.First("anyMarker1"))
assert.Equal(t, "anyTest3", markerValues.First("anyMarker2"))
}