MCPcopy
hub / github.com/mum4k/termdash / TestValuesRejectsInvalidInput

Function TestValuesRejectsInvalidInput

widgets/heatmap/heatmap_test.go:52–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestValuesRejectsInvalidInput(t *testing.T) {
53 hm, err := New()
54 if err != nil {
55 t.Fatalf("New => unexpected error: %v", err)
56 }
57
58 for _, tc := range []struct {
59 name string
60 values [][]float64
61 xs []string
62 ys []string
63 }{
64 {name: "empty", values: nil},
65 {name: "jagged", values: [][]float64{{1, 2}, {3}}},
66 {name: "x labels", values: [][]float64{{1, 2}}, xs: []string{"x0"}},
67 {name: "y labels", values: [][]float64{{1, 2}}, ys: []string{"y0", "y1"}},
68 } {
69 t.Run(tc.name, func(t *testing.T) {
70 if err := hm.Values(tc.xs, tc.ys, tc.values); err == nil {
71 t.Fatal("Values => nil error, want error")
72 }
73 })
74 }
75}
76
77func TestDrawRendersLabelsAndCells(t *testing.T) {
78 hm, err := New(CellWidth(2), XLabelCellOpts(cell.FgColor(cell.ColorGreen)), YLabelCellOpts(cell.FgColor(cell.ColorYellow)))

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
NewFunction · 0.70
ValuesMethod · 0.45

Tested by

no test coverage detected