IntInSlice and StringInSlice functions

Refs https://github.com/tendermint/tendermint/pull/835
This commit is contained in:
Anton Kaliaev
2017-11-29 12:18:03 -06:00
parent 1e12754b3a
commit 33abe87c5b
4 changed files with 48 additions and 0 deletions

14
common/int_test.go Normal file
View File

@@ -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{}))
}