MCPcopy Index your code
hub / github.com/gonum/plot / TestFloatPrecision

Function TestFloatPrecision

plotter/precision_test.go:17–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestFloatPrecision(t *testing.T) {
18 const fname = "precision_" + runtime.GOARCH + ".png"
19
20 cmpimg.CheckPlot(func() {
21 p := plot.New()
22 p.X.Label.Text = "x"
23 p.Y.Label.Text = "y"
24
25 var data = make(plotter.XYs, 10)
26 for i := range data {
27 data[i].X = float64(i)
28 data[i].Y = 1300
29 }
30
31 lines, points, err := plotter.NewLinePoints(data)
32 if err != nil {
33 log.Fatal(err)
34 }
35 p.Add(points, lines)
36 p.Add(plotter.NewGrid())
37
38 err = p.Save(300, 300, "testdata/"+fname)
39 if err != nil {
40 log.Fatal(err)
41 }
42 }, t, fname)
43}

Callers

nothing calls this directly

Calls 6

CheckPlotFunction · 0.92
NewFunction · 0.92
NewLinePointsFunction · 0.92
NewGridFunction · 0.92
SaveMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected