2016-07-12 22:38:24 -04:00
|
|
|
package chart
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-11-22 19:45:10 -05:00
|
|
|
"github.com/wcharczuk/go-chart/v2/testutil"
|
2016-07-12 22:38:24 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGenerateGridLines(t *testing.T) {
|
2020-11-22 19:45:10 -05:00
|
|
|
// replaced new assertions helper
|
2016-07-12 22:38:24 -04:00
|
|
|
|
|
|
|
ticks := []Tick{
|
2016-07-15 16:43:53 -04:00
|
|
|
{Value: 1.0, Label: "1.0"},
|
|
|
|
{Value: 2.0, Label: "2.0"},
|
|
|
|
{Value: 3.0, Label: "3.0"},
|
|
|
|
{Value: 4.0, Label: "4.0"},
|
2016-07-12 22:38:24 -04:00
|
|
|
}
|
|
|
|
|
2016-08-12 01:24:40 -04:00
|
|
|
gl := GenerateGridLines(ticks, Style{}, Style{})
|
2020-11-22 19:45:10 -05:00
|
|
|
testutil.AssertLen(t, gl, 2)
|
2016-07-27 02:55:31 -04:00
|
|
|
|
2020-11-22 19:45:10 -05:00
|
|
|
testutil.AssertEqual(t, 2.0, gl[0].Value)
|
|
|
|
testutil.AssertEqual(t, 3.0, gl[1].Value)
|
2016-07-12 22:38:24 -04:00
|
|
|
}
|