1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 22:52:29 +08:00

Merge branch 'main' into v2

This commit is contained in:
dudaodong
2022-01-26 17:44:46 +08:00
2 changed files with 42 additions and 0 deletions

View File

@@ -180,6 +180,20 @@ func TestFindLast(t *testing.T) {
assert.Equal(4, *res)
}
func TestFindLast(t *testing.T) {
nums := []int{1, 2, 3, 4, 5}
even := func(i, num int) bool {
return num%2 == 0
}
res, ok := FindLast(nums, even)
if !ok {
t.Fatal("found nothing")
}
assert := internal.NewAssert(t, "TestFindLast")
assert.Equal(4, res)
}
func TestFindFoundNothing(t *testing.T) {
nums := []int{1, 1, 1, 1, 1, 1}
findFunc := func(i, num int) bool {