stuff.
This commit is contained in:
parent
2dd44d3675
commit
b6b0409dbc
1 changed files with 5 additions and 9 deletions
|
@ -10,11 +10,9 @@ import (
|
||||||
func TestRangeTranslate(t *testing.T) {
|
func TestRangeTranslate(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
values := []float64{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}
|
values := []float64{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}
|
||||||
r := NewRange(1000, values...)
|
r := NewRangeOfFloat64(1000, values...)
|
||||||
assert.Equal(1.0, r.MinValue)
|
assert.Equal(1.0, r.GetMin())
|
||||||
assert.Equal(8.0, r.MaxValue)
|
assert.Equal(8.0, r.GetMax())
|
||||||
assert.Equal(7.0, r.MinMaxDelta)
|
|
||||||
assert.Equal(1000, r.Domain)
|
|
||||||
assert.Equal(428, r.Translate(5.0))
|
assert.Equal(428, r.Translate(5.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +29,7 @@ func TestRangeOfTimeTranslate(t *testing.T) {
|
||||||
time.Now().AddDate(0, 0, -8),
|
time.Now().AddDate(0, 0, -8),
|
||||||
}
|
}
|
||||||
r := NewRangeOfTime(1000, values...)
|
r := NewRangeOfTime(1000, values...)
|
||||||
assert.Equal(values[7], r.MinValue)
|
assert.Equal(values[7], r.GetMin())
|
||||||
assert.Equal(values[0], r.MaxValue)
|
assert.Equal(values[0], r.GetMax())
|
||||||
assert.Equal(values[0].Unix()-values[7].Unix(), r.MinMaxDelta)
|
|
||||||
assert.Equal(1000, r.Domain)
|
|
||||||
assert.Equal(571, r.Translate(time.Now().AddDate(0, 0, -5)))
|
assert.Equal(571, r.Translate(time.Now().AddDate(0, 0, -5)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue