-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinclude_some_test.go
38 lines (32 loc) · 996 Bytes
/
include_some_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
package goterators
import (
"fmt"
"testing"
)
func TestIncludeSome(t *testing.T) {
testSource := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
subList := []int{8, 15, 19}
expectedResult := true
result := IncludeSome(testSource, subList)
if result != expectedResult {
t.Errorf("Expected = %v , got = %v", expectedResult, result)
}
subList = []int{8, 15, 21}
expectedResult = true
result = IncludeSome(testSource, subList)
if result != expectedResult {
t.Errorf("Expected = %v , got = %v", expectedResult, result)
}
subList = []int{21, 22, 23}
expectedResult = false
result = IncludeSome(testSource, subList)
if result != expectedResult {
t.Errorf("Expected = %v , got = %v", expectedResult, result)
}
}
func ExampleIncludeSome() {
testSource := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
subList := []int{8, 15, 19}
result := IncludeSome(testSource, subList)
fmt.Println("IncludeSome: ", result)
}