-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintersect_test.go
More file actions
43 lines (41 loc) · 768 Bytes
/
Copy pathintersect_test.go
File metadata and controls
43 lines (41 loc) · 768 Bytes
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
package arrayutil
import "testing"
func TestIntersect(t *testing.T) {
type args struct {
arr1 interface{}
arr2 interface{}
}
tests := []struct {
name string
args args
want bool
}{{
name: "intersects",
args: args{
arr1: []int{1, 2, 3, 4, 5},
arr2: []int{6, 1},
},
want: true,
}, {
name: "does not intersects",
args: args{
arr1: []int{1, 2, 3, 4, 5},
arr2: []int{6, 8},
},
want: false,
}, {
name: "not an array",
args: args{
arr1: "I am not an array",
arr2: "I too, am not an array",
},
want: false,
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Intersect(tt.args.arr1, tt.args.arr2); got != tt.want {
t.Errorf("Intersect() = %v, want %v", got, tt.want)
}
})
}
}