mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add serie_float64 test case
This commit is contained in:
parent
8773c220f5
commit
b27fc896f9
18
pkg/types/series_float64_test.go
Normal file
18
pkg/types/series_float64_test.go
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestSeriesBaseFuncWithPushData(t *testing.T) {
|
||||||
|
series := NewFloat64Series(0.5, 1.0)
|
||||||
|
series.Push(2.5)
|
||||||
|
series.Push(3.0)
|
||||||
|
series.Push(4.0)
|
||||||
|
mean := series.Mean(5)
|
||||||
|
assert.Equal(t, 2.2, mean)
|
||||||
|
stdev := series.Stdev(5)
|
||||||
|
assert.Equal(t, 1.2884098726725126, stdev)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user