fixing range validation and tests.
This commit is contained in:
parent
b2de33058f
commit
17b28beae8
2 changed files with 63 additions and 1 deletions
|
|
@ -422,5 +422,64 @@ func TestChartValidatesSeries(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.NotNil(c.validateSeries())
|
||||
|
||||
}
|
||||
|
||||
func TestChartCheckRanges(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
c := Chart{
|
||||
Series: []Series{
|
||||
ContinuousSeries{
|
||||
XValues: []float64{1.0, 2.0},
|
||||
YValues: []float64{3.10, 3.14},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
xr, yr, yra := c.getRanges()
|
||||
assert.Nil(c.checkRanges(xr, yr, yra))
|
||||
}
|
||||
|
||||
func TestChartCheckRangesFailure(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
c := Chart{
|
||||
Series: []Series{
|
||||
ContinuousSeries{
|
||||
XValues: []float64{1.0, 2.0},
|
||||
YValues: []float64{3.14, 3.14},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
xr, yr, yra := c.getRanges()
|
||||
assert.NotNil(c.checkRanges(xr, yr, yra))
|
||||
}
|
||||
|
||||
func TestChartCheckRangesWithRanges(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
c := Chart{
|
||||
XAxis: XAxis{
|
||||
Range: &ContinuousRange{
|
||||
Min: 0,
|
||||
Max: 10,
|
||||
},
|
||||
},
|
||||
YAxis: YAxis{
|
||||
Range: &ContinuousRange{
|
||||
Min: 0,
|
||||
Max: 5,
|
||||
},
|
||||
},
|
||||
Series: []Series{
|
||||
ContinuousSeries{
|
||||
XValues: []float64{1.0, 2.0},
|
||||
YValues: []float64{3.14, 3.14},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
xr, yr, yra := c.getRanges()
|
||||
assert.Nil(c.checkRanges(xr, yr, yra))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue