go-chart/seq/random_test.go

21 lines
455 B
Go
Raw Normal View History

2017-05-12 17:17:43 -04:00
package seq
import (
"testing"
assert "github.com/blendlabs/go-assert"
)
func TestRandomRegression(t *testing.T) {
assert := assert.New(t)
2017-05-12 20:06:45 -04:00
randomProvider := NewRandom().WithLen(4096).WithMax(256)
assert.Equal(4096, randomProvider.Len())
assert.Equal(256, *randomProvider.Max())
2017-05-12 17:17:43 -04:00
2017-05-12 20:06:45 -04:00
randomSequence := New(randomProvider)
randomValues := randomSequence.Array()
assert.Len(randomValues, 4096)
assert.InDelta(128, randomSequence.Average(), 10.0)
2017-05-12 17:17:43 -04:00
}