feat: add Pipeline function

This commit is contained in:
dudaodong
2022-10-15 12:29:47 +08:00
parent 1ccf0af2b3
commit b8563ed646
3 changed files with 32 additions and 0 deletions

View File

@@ -134,3 +134,21 @@ func TestSchedule(t *testing.T) {
// expected := []string{"*", "*", "*", "*", "*"}
// assert.Equal(expected, res)
}
func TestPipeline(t *testing.T) {
assert := internal.NewAssert(t, "TestPipeline")
addOne := func(x int) int {
return x + 1
}
double := func(x int) int {
return 2 * x
}
square := func(x int) int {
return x * x
}
f := Pipeline(addOne, double, square)
assert.Equal(36, f(2))
}