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

Function TestFieldDims

plotter/field_test.go:49–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestFieldDims(t *testing.T) {
50 for _, test := range []struct {
51 rows int
52 cols int
53 }{
54 {rows: 1, cols: 2},
55 {rows: 2, cols: 1},
56 {rows: 2, cols: 2},
57 } {
58 func() {
59 defer func() {
60 r := recover()
61 if r != nil {
62 t.Errorf("unexpected panic for rows=%d cols=%d: %v", test.rows, test.cols, r)
63 }
64 }()
65
66 f := plotter.NewField(field{
67 r: test.rows, c: test.cols,
68 fn: func(x, y float64) plotter.XY {
69 return plotter.XY{
70 X: y,
71 Y: -x,
72 }
73 },
74 })
75
76 p := plot.New()
77 p.Add(f)
78
79 img := vgimg.New(250, 175)
80 dc := draw.New(img)
81
82 p.Draw(dc)
83 }()
84 }
85}

Callers

nothing calls this directly

Calls 6

NewFieldFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
DrawMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected