MCPcopy
hub / github.com/guptarohit/asciigraph / TestThresholdTakesPrecedenceOverGradient

Function TestThresholdTakesPrecedenceOverGradient

asciigraph_test.go:1022–1043  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1020}
1021
1022func TestThresholdTakesPrecedenceOverGradient(t *testing.T) {
1023 // Thresholds take precedence over SeriesColorGradient for matching points.
1024 withThreshold := PlotMany([][]float64{{1, 2, 3}},
1025 SeriesColorGradient(Blue, Green),
1026 ColorAbove(Red, 2),
1027 )
1028 if !strings.Contains(withThreshold, Red.String()) {
1029 t.Errorf("expected ColorAbove (Red) to override the gradient:\n%q", withThreshold)
1030 }
1031 gradientOnly := PlotMany([][]float64{{1, 2, 3}}, SeriesColorGradient(Blue, Green))
1032 if withThreshold == gradientOnly {
1033 t.Errorf("threshold should change the output vs gradient-only:\n%q", withThreshold)
1034 }
1035 // ColorBelow overrides the gradient too.
1036 withBelow := PlotMany([][]float64{{1, 2, 3}},
1037 SeriesColorGradient(Blue, Green),
1038 ColorBelow(Magenta, 2),
1039 )
1040 if !strings.Contains(withBelow, Magenta.String()) {
1041 t.Errorf("expected ColorBelow (Magenta) to override the gradient:\n%q", withBelow)
1042 }
1043}
1044
1045func TestThresholdAcrossSeries(t *testing.T) {
1046 // One series sits entirely above the threshold, the other entirely below —

Callers

nothing calls this directly

Calls 5

PlotManyFunction · 0.85
SeriesColorGradientFunction · 0.85
ColorAboveFunction · 0.85
ColorBelowFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…