| 1 |
package drawing |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/wcharczuk/go-chart/v2/testutil" |
| 7 |
) |
| 8 |
|
| 9 |
type point struct { |
| 10 |
X, Y float64 |
| 11 |
} |
| 12 |
|
| 13 |
type mockLine struct { |
| 14 |
inner []point |
| 15 |
} |
| 16 |
|
| 17 |
func (ml *mockLine) LineTo(x, y float64) { |
| 18 |
ml.inner = append(ml.inner, point{x, y}) |
| 19 |
} |
| 20 |
|
| 21 |
func (ml mockLine) Len() int { |
| 22 |
return len(ml.inner) |
| 23 |
} |
| 24 |
|
| 25 |
func TestTraceQuad(t *testing.T) { |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
quad := []float64{10, 20, 20, 20, 20, 10} |
| 32 |
liner := &mockLine{} |
| 33 |
TraceQuad(liner, quad, 0.5) |
| 34 |
testutil.AssertNotZero(t, liner.Len()) |
| 35 |
} |