-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdrop_test.go
More file actions
42 lines (30 loc) · 767 Bytes
/
drop_test.go
File metadata and controls
42 lines (30 loc) · 767 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
package underscore_test
import (
"testing"
"github.com/stretchr/testify/assert"
u "github.com/rjNemo/underscore"
)
func TestDrop(t *testing.T) {
nums := []int{1, 2, 3, 4, 5}
want := []int{3, 4, 5}
assert.Equal(t, want, u.Drop(nums, 2))
}
func TestDropNone(t *testing.T) {
nums := []int{1, 2, 3, 4, 5}
assert.Equal(t, nums, u.Drop(nums, 0))
assert.Equal(t, nums, u.Drop(nums, -1))
}
func TestDropAll(t *testing.T) {
nums := []int{1, 2, 3, 4, 5}
assert.Empty(t, u.Drop(nums, 5))
assert.Empty(t, u.Drop(nums, 10))
}
func TestDropEmpty(t *testing.T) {
result := u.Drop([]int{}, 5)
assert.Empty(t, result)
}
func TestDropSingleElement(t *testing.T) {
nums := []int{42}
assert.Equal(t, nums, u.Drop(nums, 0))
assert.Empty(t, u.Drop(nums, 1))
}