From 45436798af110972aee8c3d58f0ec042892ad86b Mon Sep 17 00:00:00 2001 From: dudaodong Date: Wed, 18 May 2022 15:23:57 +0800 Subject: [PATCH] fix: fix TestMinBy test function --- mathutil/mathutil_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mathutil/mathutil_test.go b/mathutil/mathutil_test.go index 3d93bf4..5e5da0d 100644 --- a/mathutil/mathutil_test.go +++ b/mathutil/mathutil_test.go @@ -119,18 +119,18 @@ func TestMin(t *testing.T) { func TestMinBy(t *testing.T) { assert := internal.NewAssert(t, "TestMinBy") - res1 := MaxBy([]string{"a", "ab", "abc"}, func(v1, v2 string) bool { + res1 := MinBy([]string{"a", "ab", "abc"}, func(v1, v2 string) bool { return len(v1) < len(v2) }) assert.Equal("a", res1) - res2 := MaxBy([]string{"ab", "ac", "abc"}, func(v1, v2 string) bool { + res2 := MinBy([]string{"ab", "ac", "abc"}, func(v1, v2 string) bool { return len(v1) < len(v2) }) assert.Equal("ab", res2) - res3 := MaxBy([]string{}, func(v1, v2 string) bool { - return len(v1) > len(v2) + res3 := MinBy([]string{}, func(v1, v2 string) bool { + return len(v1) < len(v2) }) assert.Equal("", res3) -} \ No newline at end of file +}