removing go-sdk

This commit is contained in:
Will Charczuk 2023-09-11 12:21:40 -04:00
parent 2ff54048b8
commit 2c2fb0651b
2 changed files with 15 additions and 17 deletions

View file

@ -3,44 +3,41 @@ package chart
import ( import (
"testing" "testing"
"github.com/blend/go-sdk/assert" "github.com/wcharczuk/go-chart/v2/testutil"
) )
func TestLogRangeTranslate(t *testing.T) { func TestLogRangeTranslate(t *testing.T) {
assert := assert.New(t)
values := []float64{1, 10, 100, 1000, 10000, 100000, 1000000} values := []float64{1, 10, 100, 1000, 10000, 100000, 1000000}
r := LogarithmicRange{Domain: 1000} r := LogarithmicRange{Domain: 1000}
r.Min, r.Max = MinMax(values...) r.Min, r.Max = MinMax(values...)
assert.Equal(0, r.Translate(0)) // goes to bottom testutil.AssertEqual(t, 0, r.Translate(0)) // goes to bottom
assert.Equal(0, r.Translate(1)) // goes to bottom testutil.AssertEqual(t, 0, r.Translate(1)) // goes to bottom
assert.Equal(160, r.Translate(10)) // roughly 1/6th of max testutil.AssertEqual(t, 160, r.Translate(10)) // roughly 1/6th of max
assert.Equal(500, r.Translate(1000)) // roughly 1/2 of max (1.0e6 / 1.0e3) testutil.AssertEqual(t, 500, r.Translate(1000)) // roughly 1/2 of max (1.0e6 / 1.0e3)
assert.Equal(1000, r.Translate(1000000)) // max value testutil.AssertEqual(t, 1000, r.Translate(1000000)) // max value
} }
func TestGetTicks(t *testing.T) { func TestGetTicks(t *testing.T) {
assert := assert.New(t)
values := []float64{35, 512, 1525122} values := []float64{35, 512, 1525122}
r := LogarithmicRange{Domain: 1000} r := LogarithmicRange{Domain: 1000}
r.Min, r.Max = MinMax(values...) r.Min, r.Max = MinMax(values...)
ticks := r.GetTicks(nil, Style{}, FloatValueFormatter) ticks := r.GetTicks(nil, Style{}, FloatValueFormatter)
assert.Equal(7, len(ticks)) testutil.AssertEqual(t, 7, len(ticks))
assert.Equal(10, ticks[0].Value) testutil.AssertEqual(t, 10, ticks[0].Value)
assert.Equal(100, ticks[1].Value) testutil.AssertEqual(t, 100, ticks[1].Value)
assert.Equal(10000000, ticks[6].Value) testutil.AssertEqual(t, 10000000, ticks[6].Value)
} }
func TestGetTicksFromHigh(t *testing.T) { func TestGetTicksFromHigh(t *testing.T) {
assert := assert.New(t)
values := []float64{1412, 352144, 1525122} // min tick should be 1000 values := []float64{1412, 352144, 1525122} // min tick should be 1000
r := LogarithmicRange{} r := LogarithmicRange{}
r.Min, r.Max = MinMax(values...) r.Min, r.Max = MinMax(values...)
ticks := r.GetTicks(nil, Style{}, FloatValueFormatter) ticks := r.GetTicks(nil, Style{}, FloatValueFormatter)
assert.Equal(5, len(ticks)) testutil.AssertEqual(t, 5, len(ticks))
assert.Equal(float64(1000), ticks[0].Value) testutil.AssertEqual(t, float64(1000), ticks[0].Value)
assert.Equal(float64(10000), ticks[1].Value) testutil.AssertEqual(t, float64(10000), ticks[1].Value)
assert.Equal(float64(10000000), ticks[4].Value) testutil.AssertEqual(t, float64(10000000), ticks[4].Value)
} }

View file

@ -4,6 +4,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/blend/go-sdk/assert"
"github.com/wcharczuk/go-chart/v2/testutil" "github.com/wcharczuk/go-chart/v2/testutil"
) )