|
|
@ -9,20 +9,6 @@ import ( |
|
|
|
"github.com/stretchr/testify/assert" |
|
|
|
"github.com/stretchr/testify/assert" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func TestSliceContains(t *testing.T) { |
|
|
|
|
|
|
|
assert.True(t, SliceContains([]int{2, 0, 2, 3}, 2)) |
|
|
|
|
|
|
|
assert.True(t, SliceContains([]int{2, 0, 2, 3}, 0)) |
|
|
|
|
|
|
|
assert.True(t, SliceContains([]int{2, 0, 2, 3}, 3)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.True(t, SliceContains([]string{"2", "0", "2", "3"}, "0")) |
|
|
|
|
|
|
|
assert.True(t, SliceContains([]float64{2, 0, 2, 3}, 0)) |
|
|
|
|
|
|
|
assert.True(t, SliceContains([]bool{false, true, false}, true)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.False(t, SliceContains([]int{2, 0, 2, 3}, 4)) |
|
|
|
|
|
|
|
assert.False(t, SliceContains([]int{}, 4)) |
|
|
|
|
|
|
|
assert.False(t, SliceContains(nil, 4)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestSliceContainsString(t *testing.T) { |
|
|
|
func TestSliceContainsString(t *testing.T) { |
|
|
|
assert.True(t, SliceContainsString([]string{"c", "b", "a", "b"}, "a")) |
|
|
|
assert.True(t, SliceContainsString([]string{"c", "b", "a", "b"}, "a")) |
|
|
|
assert.True(t, SliceContainsString([]string{"c", "b", "a", "b"}, "b")) |
|
|
|
assert.True(t, SliceContainsString([]string{"c", "b", "a", "b"}, "b")) |
|
|
@ -54,25 +40,6 @@ func TestSliceSortedEqual(t *testing.T) { |
|
|
|
assert.False(t, SliceSortedEqual([]int{2, 0, 0, 3}, []int{2, 0, 2, 3})) |
|
|
|
assert.False(t, SliceSortedEqual([]int{2, 0, 0, 3}, []int{2, 0, 2, 3})) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestSliceEqual(t *testing.T) { |
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]int{2, 0, 2, 3}, []int{2, 0, 2, 3})) |
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]int{}, []int{})) |
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]int(nil), nil)) |
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]int(nil), []int{})) |
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]int{}, []int{})) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]string{"2", "0", "2", "3"}, []string{"2", "0", "2", "3"})) |
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]float64{2, 0, 2, 3}, []float64{2, 0, 2, 3})) |
|
|
|
|
|
|
|
assert.True(t, SliceEqual([]bool{false, true, false}, []bool{false, true, false})) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.False(t, SliceEqual([]int{3, 0, 2, 2}, []int{2, 0, 2, 3})) |
|
|
|
|
|
|
|
assert.False(t, SliceEqual([]int{2, 0, 2}, []int{2, 0, 2, 3})) |
|
|
|
|
|
|
|
assert.False(t, SliceEqual([]int{}, []int{2, 0, 2, 3})) |
|
|
|
|
|
|
|
assert.False(t, SliceEqual(nil, []int{2, 0, 2, 3})) |
|
|
|
|
|
|
|
assert.False(t, SliceEqual([]int{2, 0, 2, 4}, []int{2, 0, 2, 3})) |
|
|
|
|
|
|
|
assert.False(t, SliceEqual([]int{2, 0, 0, 3}, []int{2, 0, 2, 3})) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestSliceRemoveAll(t *testing.T) { |
|
|
|
func TestSliceRemoveAll(t *testing.T) { |
|
|
|
assert.ElementsMatch(t, []int{2, 2, 3}, SliceRemoveAll([]int{2, 0, 2, 3}, 0)) |
|
|
|
assert.ElementsMatch(t, []int{2, 2, 3}, SliceRemoveAll([]int{2, 0, 2, 3}, 0)) |
|
|
|
assert.ElementsMatch(t, []int{0, 3}, SliceRemoveAll([]int{2, 0, 2, 3}, 2)) |
|
|
|
assert.ElementsMatch(t, []int{0, 3}, SliceRemoveAll([]int{2, 0, 2, 3}, 2)) |
|
|
|