2016-07-07 03:54:00 +02:00
|
|
|
package chart
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/blendlabs/go-assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRangeTranslate(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
values := []float64{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}
|
2016-07-07 23:44:03 +02:00
|
|
|
r := Range{Domain: 1000}
|
|
|
|
r.Min, r.Max = MinAndMax(values...)
|
2016-07-07 03:54:00 +02:00
|
|
|
assert.Equal(428, r.Translate(5.0))
|
|
|
|
}
|