-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathin_test.go
79 lines (64 loc) · 1.79 KB
/
in_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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package in
import (
"testing"
)
func TestStrings(t *testing.T) {
result1 := Strings([]string{"11", "22"}, "22")
if result1 != true {
t.Error("Expected to be true, got ", result1)
}
result2 := Strings([]string{"11", "22"}, "33")
if result2 != false {
t.Error("Expected to be false, got ", result2)
}
}
func TestInts(t *testing.T) {
result1 := Ints([]int{11, 22}, 22)
if result1 != true {
t.Error("Expected to be true, got ", result1)
}
result2 := Ints([]int{11, 22}, 33)
if result2 != false {
t.Error("Expected to be false, got ", result2)
}
}
func TestStringsSubset(t *testing.T) {
result1 := StringsSubset([]string{"11", "22"}, []string{"22"})
if result1 != true {
t.Error("Expected to be true, got ", result1)
}
result2 := StringsSubset([]string{"11", "22"}, []string{"33"})
if result2 != false {
t.Error("Expected to be false, got ", result2)
}
}
func TestIntsSubset(t *testing.T) {
result1 := IntsSubset([]int{11, 22}, []int{22})
if result1 != true {
t.Error("Expected to be true, got ", result1)
}
result2 := IntsSubset([]int{11, 22}, []int{33})
if result2 != false {
t.Error("Expected to be false, got ", result2)
}
}
func TestStringsIntersection(t *testing.T) {
result1 := StringsIntersection([]string{"2", "5"}, []string{"1", "4", "5"})
if result1 != true {
t.Error("Expected to be true, got ", result1)
}
result2 := StringsIntersection([]string{"2", "5"}, []string{"1", "4", "6"})
if result2 != false {
t.Error("Expected to be false, got ", result2)
}
}
func TestIntsIntersection(t *testing.T) {
result1 := IntsIntersection([]int{2, 5}, []int{1, 4, 5})
if result1 != true {
t.Error("Expected to be true, got ", result1)
}
result2 := IntsIntersection([]int{2, 5}, []int{1, 4, 6})
if result2 != false {
t.Error("Expected to be false, got ", result2)
}
}