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

feat: add Stream package

This commit is contained in:
dudaodong
2023-01-17 11:25:15 +08:00
parent bc3c080ac3
commit 61338b6b46
2 changed files with 100 additions and 0 deletions

25
stream/stream_test.go Normal file
View File

@@ -0,0 +1,25 @@
package stream
import (
"testing"
"github.com/duke-git/lancet/v2/internal"
)
func TestFromSlice(t *testing.T) {
assert := internal.NewAssert(t, "TestFromSlice")
stream := FromSlice([]int{1, 2, 3})
assert.Equal([]int{1, 2, 3}, stream.ToSlice())
}
func TestFromRange(t *testing.T) {
assert := internal.NewAssert(t, "TestFromSlice")
s1 := FromRange(1, 5, 1)
s2 := FromRange(1.1, 5.0, 1.0)
assert.Equal([]int{1, 2, 3, 4, 5}, s1.ToSlice())
assert.Equal([]float64{1.1, 2.1, 3.1, 4.1}, s2.ToSlice())
}