Adding upstream version 2.1.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c8c64afc61
commit
41a2f19f12
220 changed files with 19814 additions and 0 deletions
22
continuous_range_test.go
Normal file
22
continuous_range_test.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package chart
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
||||
)
|
||||
|
||||
func TestRangeTranslate(t *testing.T) {
|
||||
// replaced new assertions helper
|
||||
values := []float64{1.0, 2.0, 2.5, 2.7, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}
|
||||
r := ContinuousRange{Domain: 1000}
|
||||
r.Min, r.Max = MinMax(values...)
|
||||
|
||||
// delta = ~7.0
|
||||
// value = ~5.0
|
||||
// domain = ~1000
|
||||
// 5/8 * 1000 ~=
|
||||
testutil.AssertEqual(t, 0, r.Translate(1.0))
|
||||
testutil.AssertEqual(t, 1000, r.Translate(8.0))
|
||||
testutil.AssertEqual(t, 572, r.Translate(5.0))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue