Skip to content

Commit

Permalink
feat: Implement funk.Partition
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenvantuan2391996 committed Aug 8, 2023
1 parent 5cdac4c commit 2133b93
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ func Test_partition_valid_int(t *testing.T) {
assert.Equal(t, [][]int{{2, 4}, {1, 3}}, result)
}

func Test_partition_valid_float64(t *testing.T) {
result := Partition([]float64{1.1, 2.2, 3.3, 4.4}, func(n float64) bool {
return n > float64(2)
})

assert.Equal(t, [][]float64{{2.2, 3.3, 4.4}, {1.1}}, result)
}

func Test_partition_valid_string(t *testing.T) {
result := Partition([]string{"a", "b", "c"}, func(n string) bool {
return n > "a"
Expand Down

0 comments on commit 2133b93

Please sign in to comment.