mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
feat:addFindLast for stream (#95)
Co-authored-by: sunyaoyao <sunyaoyao@kezaihui.com>
This commit is contained in:
1 parent
aa8e0d5c12
commit
1616d3d1be
3 files changed
+43
No files matched your search
@@ -273,6 +273,24 @@ func TestStream_FindFirst(t *testing.T) {
|
||||
assert.Equal(true, ok)
|
||||
}
|
||||
|
||||
func TestStream_FindLast(t *testing.T) {
|
||||
assert := internal.NewAssert(t, "TestStream_FindLast")
|
||||
|
||||
stream := FromSlice([]int{3, 2, 1})
|
||||
|
||||
result, ok := stream.FindLast()
|
||||
|
||||
assert.Equal(1, result)
|
||||
assert.Equal(true, ok)
|
||||
|
||||
stream2 := FromSlice([]int{})
|
||||
|
||||
result, ok = stream2.FindLast()
|
||||
|
||||
assert.Equal(0, result)
|
||||
assert.Equal(false, ok)
|
||||
}
|
||||
|
||||
func TestStream_Reverse(t *testing.T) {
|
||||
assert := internal.NewAssert(t, "TestStream_Reverse")
|
||||
|
||||
|
||||
Reference in new issue
Block a user