This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
summer-utils/utils/slice-utils_test.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"))
}