Refs https://github.com/tendermint/tendermint/pull/835pull/1842/head
@ -0,0 +1,14 @@ | |||||
package common | |||||
import ( | |||||
"testing" | |||||
"github.com/stretchr/testify/assert" | |||||
) | |||||
func TestIntInSlice(t *testing.T) { | |||||
assert.True(t, IntInSlice(1, []int{1, 2, 3})) | |||||
assert.False(t, IntInSlice(4, []int{1, 2, 3})) | |||||
assert.True(t, IntInSlice(0, []int{0})) | |||||
assert.False(t, IntInSlice(0, []int{})) | |||||
} |
@ -0,0 +1,14 @@ | |||||
package common | |||||
import ( | |||||
"testing" | |||||
"github.com/stretchr/testify/assert" | |||||
) | |||||
func TestStringInSlice(t *testing.T) { | |||||
assert.True(t, StringInSlice("a", []string{"a", "b", "c"})) | |||||
assert.False(t, StringInSlice("d", []string{"a", "b", "c"})) | |||||
assert.True(t, StringInSlice("", []string{""})) | |||||
assert.False(t, StringInSlice("", []string{})) | |||||
} |