go-chart/sequence/sequence_test.go
Will Charczuk 814470733e snapshot.
2017-04-29 21:12:39 -07:00

27 lines
494 B
Go

package sequence
import (
"testing"
assert "github.com/blendlabs/go-assert"
)
func TestSequenceEach(t *testing.T) {
assert := assert.New(t)
values := Seq{Array([]float64{1, 2, 3, 4})}
values.Each(func(i int, v float64) {
assert.Equal(i, v)
})
}
func TestSequenceMap(t *testing.T) {
assert := assert.New(t)
values := Seq{Array([]float64{1, 2, 3, 4})}
mapped := values.Map(func(i int, v float64) float64 {
assert.Equal(i, v)
return v * 2
})
assert.Equal(4, mapped.Len())
}