19 lines
555 B
Go
19 lines
555 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestContains2(t *testing.T) {
|
||
|
assert.True(t, Contains[string]([]string{"hello", "world"}, "hello"))
|
||
|
assert.True(t, Contains[string]([]string{"hello", "world"}, "world"))
|
||
|
assert.False(t, Contains[string]([]string{"hello", "world"}, "another"))
|
||
|
}
|
||
|
|
||
|
func TestCount2(t *testing.T) {
|
||
|
assert.Equal(t, 0, Count[string]([]string{}, "hello"))
|
||
|
assert.Equal(t, 1, Count[string]([]string{"hello"}, "hello"))
|
||
|
assert.Equal(t, 2, Count[string]([]string{"hello", "hello"}, "hello"))
|
||
|
}
|