-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathint_test.go
44 lines (38 loc) · 923 Bytes
/
int_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
package golib
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestInt64Intersect(t *testing.T) {
aOnly, bOnly, both := Int64Intersect([]int64{1, 2, 3}, []int64{2, 3, 4})
if !assert.ElementsMatch(t, []int64{1}, aOnly) {
return
}
if !assert.ElementsMatch(t, []int64{4}, bOnly) {
return
}
if !assert.ElementsMatch(t, []int64{2, 3}, both) {
return
}
aOnly, bOnly, both = Int64Intersect([]int64{1, 2, 3}, []int64{1, 2, 3})
if !assert.ElementsMatch(t, []int64{}, aOnly) {
return
}
if !assert.ElementsMatch(t, []int64{}, bOnly) {
return
}
if !assert.ElementsMatch(t, []int64{1, 2, 3}, both) {
return
}
aOnly, bOnly, both = Int64Intersect([]int64{1, 2, 3}, []int64{4, 5, 6})
if !assert.ElementsMatch(t, []int64{1, 2, 3}, aOnly) {
return
}
if !assert.ElementsMatch(t, []int64{4, 5, 6}, bOnly) {
return
}
if !assert.ElementsMatch(t, []int64{}, both) {
return
}
return
}