forked from tobyhede/go-underscore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpartition_test.go
More file actions
47 lines (31 loc) · 735 Bytes
/
partition_test.go
File metadata and controls
47 lines (31 loc) · 735 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
44
45
46
47
package un
import "testing"
func init() {
}
func TestPartitionWithSliceInterface(t *testing.T) {
fn := func(s interface{}) bool {
return true
}
receive, _ := Partition(fn, SLICE_STRING)
expect := SLICE_STRING
equals(t, ToI(expect), receive)
}
func TestPartitionWithMapInterface(t *testing.T) {
fn := func(s interface{}) bool {
return true
}
receive, _ := Partition(fn, MAP_STRING_TO_INT)
expect := MAP_STRING_TO_INT
equals(t, len(expect), len(receive))
display(receive)
}
func TestPartitionWithSliceInt(t *testing.T) {
fn := func(i int) bool {
return i < 5
}
under, over := Partition(fn, SLICE_INT)
equals(t, 5, len(under))
equals(t, 5, len(over))
equals(t, 0, under[0])
equals(t, 5, over[0])
}