adding GetLastBoundedValue and tests
This commit is contained in:
parent
d888440415
commit
f8573f1123
2 changed files with 47 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package chart
|
||||
|
||||
import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/blendlabs/go-assert"
|
||||
|
|
@ -30,3 +31,21 @@ func TestBollingerBandSeries(t *testing.T) {
|
|||
assert.True(y1values[x] > y2values[x])
|
||||
}
|
||||
}
|
||||
|
||||
func TestBollingerBandLastValue(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
s1 := mockValueProvider{
|
||||
X: Seq(1.0, 100.0),
|
||||
Y: Seq(1.0, 100.0),
|
||||
}
|
||||
|
||||
bbs := &BollingerBandsSeries{
|
||||
InnerSeries: s1,
|
||||
}
|
||||
|
||||
x, y1, y2 := bbs.GetLastBoundedValue()
|
||||
assert.Equal(100.0, x)
|
||||
assert.Equal(100, math.Floor(y1))
|
||||
assert.Equal(95, math.Floor(y2))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue