go-chart/histogram_series_test.go
Will Charczuk 03708a90ef Helper API refactor (#40)
* api cleaup

* updates

* wtf

* updates

* snapshot.

* tweaks

* snapshot

* api tweaks.

* updates

* updates

* updates

* changes.

* updates

* updates

* sequence => seq

* dont need to use curl, just using wget

* fixing examples
2017-05-12 17:12:23 -07:00

33 lines
642 B
Go

package chart
import (
"testing"
assert "github.com/blendlabs/go-assert"
"github.com/wcharczuk/go-chart/seq"
)
func TestHistogramSeries(t *testing.T) {
assert := assert.New(t)
cs := ContinuousSeries{
Name: "Test Series",
XValues: seq.Range(1.0, 20.0),
YValues: seq.Range(10.0, -10.0),
}
hs := HistogramSeries{
InnerSeries: cs,
}
for x := 0; x < hs.Len(); x++ {
csx, csy := cs.GetValues(0)
hsx, hsy1, hsy2 := hs.GetBoundedValues(0)
assert.Equal(csx, hsx)
assert.True(hsy1 > 0)
assert.True(hsy2 <= 0)
assert.True(csy < 0 || (csy > 0 && csy == hsy1))
assert.True(csy > 0 || (csy < 0 && csy == hsy2))
}
}