Debian Codegraph @

concat_series_test.go

raw symbols SCIP
1 package chart
2
3 import (
4 "testing"
5
6 "github.com/wcharczuk/go-chart/v2/testutil"
7 )
8
9 func TestConcatSeries(t *testing.T) {
10 // replaced new assertions helper
11
12 s1 := ContinuousSeries{
13 XValues: LinearRange(1.0, 10.0),
14 YValues: LinearRange(1.0, 10.0),
15 }
16
17 s2 := ContinuousSeries{
18 XValues: LinearRange(11, 20.0),
19 YValues: LinearRange(10.0, 1.0),
20 }
21
22 s3 := ContinuousSeries{
23 XValues: LinearRange(21, 30.0),
24 YValues: LinearRange(1.0, 10.0),
25 }
26
27 cs := ConcatSeries([]Series{s1, s2, s3})
28 testutil.AssertEqual(t, 30, cs.Len())
29
30 x0, y0 := cs.GetValue(0)
31 testutil.AssertEqual(t, 1.0, x0)
32 testutil.AssertEqual(t, 1.0, y0)
33
34 xm, ym := cs.GetValue(19)
35 testutil.AssertEqual(t, 20.0, xm)
36 testutil.AssertEqual(t, 1.0, ym)
37
38 xn, yn := cs.GetValue(29)
39 testutil.AssertEqual(t, 30.0, xn)
40 testutil.AssertEqual(t, 10.0, yn)
41 }