|
@@ -18,22 +18,38 @@ func TestBarHalfStep(t *testing.T) {
|
|
|
|
|
|
BarColor := ColorText("BLUE")
|
|
|
|
|
|
+ Bar25 := ColorText("RED")
|
|
|
+ Bar50 := ColorText("BROWN")
|
|
|
+ Bar75 := ColorText("BOLD YEL")
|
|
|
+ Bar95 := ColorText("GREEN")
|
|
|
+ Bar100 := ColorText("BRI GREEN")
|
|
|
+
|
|
|
bar := BarLine{Line: Line{DefaultColor: BarColor}, Width: 10, Style: SOLID}
|
|
|
- BarSolid := map[int]string{0: BarColor + " ",
|
|
|
- 5: BarColor + " ",
|
|
|
- 10: BarColor + "\u2588 ",
|
|
|
- 20: BarColor + "\u2588\u2588 ",
|
|
|
- 25: BarColor + "\u2588\u2588 ",
|
|
|
- 50: BarColor + "\u2588\u2588\u2588\u2588\u2588 ",
|
|
|
- 75: BarColor + "\u2588\u2588\u2588\u2588\u2588\u2588\u2588 ",
|
|
|
- 100: BarColor + "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
|
|
|
+ bar.ColorRange = []BarRange{
|
|
|
+ {2500, Bar25},
|
|
|
+ {5000, Bar50},
|
|
|
+ {7500, Bar75},
|
|
|
+ {9500, Bar95},
|
|
|
+ {10100, Bar100}}
|
|
|
+
|
|
|
+ BarSolid := map[int]string{0: Bar25 + " ",
|
|
|
+ 5: Bar25 + " ",
|
|
|
+ 10: Bar25 + "\u2588 ",
|
|
|
+ 20: Bar25 + "\u2588\u2588 ",
|
|
|
+ 25: Bar25 + "\u2588\u2588 ",
|
|
|
+ 30: Bar50 + "\u2588\u2588\u2588 ",
|
|
|
+ 50: Bar50 + "\u2588\u2588\u2588\u2588\u2588 ",
|
|
|
+ 75: Bar75 + "\u2588\u2588\u2588\u2588\u2588\u2588\u2588 ",
|
|
|
+ 90: Bar95 + "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 ",
|
|
|
+ 95: Bar95 + "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 ",
|
|
|
+ 100: Bar100 + "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
|
|
|
}
|
|
|
|
|
|
for pct, text := range BarSolid {
|
|
|
bar.Percent = int64(pct * 100)
|
|
|
got := bar.Output()
|
|
|
if got != text {
|
|
|
- t.Errorf("BarHalf: Expected %#v (%d%%), got %#v", text, pct, got)
|
|
|
+ t.Errorf("BarSolidRange: Expected %#v (%d%%), got %#v", text, pct, got)
|
|
|
}
|
|
|
}
|
|
|
|