2018-09-07 15:52:30 -04:00
|
|
|
package chart
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-10-27 22:52:38 -04:00
|
|
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
2018-09-07 15:52:30 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestFirstValueAnnotation(t *testing.T) {
|
2020-11-22 19:45:10 -05:00
|
|
|
// replaced new assertions helper
|
2018-09-07 15:52:30 -04:00
|
|
|
|
|
|
|
series := ContinuousSeries{
|
|
|
|
XValues: []float64{1.0, 2.0, 3.0, 4.0, 5.0},
|
|
|
|
YValues: []float64{5.0, 3.0, 3.0, 2.0, 1.0},
|
|
|
|
}
|
|
|
|
|
|
|
|
fva := FirstValueAnnotation(series)
|
2020-11-22 19:45:10 -05:00
|
|
|
testutil.AssertNotEmpty(t, fva.Annotations)
|
2018-09-07 15:52:30 -04:00
|
|
|
fvaa := fva.Annotations[0]
|
2020-11-22 19:45:10 -05:00
|
|
|
testutil.AssertEqual(t, 1, fvaa.XValue)
|
|
|
|
testutil.AssertEqual(t, 5, fvaa.YValue)
|
2018-09-07 15:52:30 -04:00
|
|
|
}
|