mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-08 06:32:28 +08:00
refactor: change function name EqualWithFunc to EqualWith
This commit is contained in:
@@ -162,8 +162,8 @@ func Equal[T comparable](slice1, slice2 []T) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// EqualWithFunc checks if two slices are equal with comparator func
|
||||
func EqualWithFunc[T, U any](slice1 []T, slice2 []U, comparator func(T, U) bool) bool {
|
||||
// EqualWith checks if two slices are equal with comparator func
|
||||
func EqualWith[T, U any](slice1 []T, slice2 []U, comparator func(T, U) bool) bool {
|
||||
if len(slice1) != len(slice2) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ func TestEqual(t *testing.T) {
|
||||
assert.Equal(false, Equal(slice1, slice3))
|
||||
}
|
||||
|
||||
func TestEqualWithFunc(t *testing.T) {
|
||||
assert := internal.NewAssert(t, "TestEqualWithFunc")
|
||||
func TestEqualWith(t *testing.T) {
|
||||
assert := internal.NewAssert(t, "TestEqualWith")
|
||||
|
||||
slice1 := []int{1, 2, 3}
|
||||
slice2 := []int{2, 4, 6}
|
||||
@@ -89,7 +89,7 @@ func TestEqualWithFunc(t *testing.T) {
|
||||
return b == a*2
|
||||
}
|
||||
|
||||
assert.Equal(true, EqualWithFunc(slice1, slice2, isDouble))
|
||||
assert.Equal(true, EqualWith(slice1, slice2, isDouble))
|
||||
}
|
||||
|
||||
func TestEvery(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user