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

Function TestNewAndValues

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

Source from the content-addressed store, hash-verified

26)
27
28func TestNewAndValues(t *testing.T) {
29 hm, err := New(CellWidth(2))
30 if err != nil {
31 t.Fatalf("New => unexpected error: %v", err)
32 }
33
34 if err := hm.Values(nil, nil, [][]float64{{1, 2}, {3, 4}}); err != nil {
35 t.Fatalf("Values => unexpected error: %v", err)
36 }
37
38 if got, want := hm.xLabels, []string{"0", "1"}; len(got) != len(want) || got[0] != want[0] || got[1] != want[1] {
39 t.Fatalf("xLabels = %v, want %v", got, want)
40 }
41 if got, want := hm.yLabels, []string{"0", "1"}; len(got) != len(want) || got[0] != want[0] || got[1] != want[1] {
42 t.Fatalf("yLabels = %v, want %v", got, want)
43 }
44 if got, want := hm.minValue, 1.0; got != want {
45 t.Fatalf("minValue = %v, want %v", got, want)
46 }
47 if got, want := hm.maxValue, 4.0; got != want {
48 t.Fatalf("maxValue = %v, want %v", got, want)
49 }
50}
51
52func TestValuesRejectsInvalidInput(t *testing.T) {
53 hm, err := New()

Callers

nothing calls this directly

Calls 3

CellWidthFunction · 0.85
NewFunction · 0.70
ValuesMethod · 0.45

Tested by

no test coverage detected