|
@@ -15,26 +15,26 @@ func TestBarsMatch(t *testing.T) {
|
|
// verify that the BARS_CP437 matches BARS_UNICODE
|
|
// verify that the BARS_CP437 matches BARS_UNICODE
|
|
// When translated via CP437_to_Unicode().
|
|
// When translated via CP437_to_Unicode().
|
|
|
|
|
|
- cp437 := BARS_CP437.solid
|
|
|
|
|
|
+ cp437 := BARS_CP437.Solid
|
|
convert := CP437_to_Unicode(cp437)
|
|
convert := CP437_to_Unicode(cp437)
|
|
- unicode := BARS_UNICODE.solid
|
|
|
|
|
|
+ unicode := BARS_UNICODE.Solid
|
|
if convert != unicode {
|
|
if convert != unicode {
|
|
t.Errorf("BARS solid: %#v != %#v\n", unicode, convert)
|
|
t.Errorf("BARS solid: %#v != %#v\n", unicode, convert)
|
|
}
|
|
}
|
|
|
|
|
|
for half := 0; half < 2; half++ {
|
|
for half := 0; half < 2; half++ {
|
|
- cp437 := BARS_CP437.half[half]
|
|
|
|
|
|
+ cp437 := BARS_CP437.Half[half]
|
|
convert := CP437_to_Unicode(cp437)
|
|
convert := CP437_to_Unicode(cp437)
|
|
- unicode := BARS_UNICODE.half[half]
|
|
|
|
|
|
+ unicode := BARS_UNICODE.Half[half]
|
|
if convert != unicode {
|
|
if convert != unicode {
|
|
t.Errorf("BARS half[%d]: %#v != %#v\n", half, unicode, convert)
|
|
t.Errorf("BARS half[%d]: %#v != %#v\n", half, unicode, convert)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
for grad := 0; grad < 4; grad++ {
|
|
for grad := 0; grad < 4; grad++ {
|
|
- cp437 := BARS_CP437.gradient[grad]
|
|
|
|
|
|
+ cp437 := BARS_CP437.Gradient[grad]
|
|
convert := CP437_to_Unicode(cp437)
|
|
convert := CP437_to_Unicode(cp437)
|
|
- unicode := BARS_UNICODE.gradient[grad]
|
|
|
|
|
|
+ unicode := BARS_UNICODE.Gradient[grad]
|
|
if convert != unicode {
|
|
if convert != unicode {
|
|
t.Errorf("BARS gradient[%d]: %#v != %#v\n", grad, unicode, convert)
|
|
t.Errorf("BARS gradient[%d]: %#v != %#v\n", grad, unicode, convert)
|
|
}
|
|
}
|
|
@@ -79,15 +79,15 @@ func testBars(t *testing.T) {
|
|
|
|
|
|
BarSolid := map[int]string{0: Bar25 + " ",
|
|
BarSolid := map[int]string{0: Bar25 + " ",
|
|
5: Bar25 + " ",
|
|
5: Bar25 + " ",
|
|
- 10: Bar25 + BARS.solid + " ",
|
|
|
|
- 20: Bar25 + strings.Repeat(BARS.solid, 2) + " ",
|
|
|
|
- 25: Bar25 + strings.Repeat(BARS.solid, 2) + " ",
|
|
|
|
- 30: Bar50 + strings.Repeat(BARS.solid, 3) + " ",
|
|
|
|
- 50: Bar50 + strings.Repeat(BARS.solid, 5) + " ",
|
|
|
|
- 75: Bar75 + strings.Repeat(BARS.solid, 7) + " ",
|
|
|
|
- 90: Bar95 + strings.Repeat(BARS.solid, 9) + " ",
|
|
|
|
- 95: Bar95 + strings.Repeat(BARS.solid, 9) + " ",
|
|
|
|
- 100: Bar100 + strings.Repeat(BARS.solid, 10) + "",
|
|
|
|
|
|
+ 10: Bar25 + BARS.Solid + " ",
|
|
|
|
+ 20: Bar25 + strings.Repeat(BARS.Solid, 2) + " ",
|
|
|
|
+ 25: Bar25 + strings.Repeat(BARS.Solid, 2) + " ",
|
|
|
|
+ 30: Bar50 + strings.Repeat(BARS.Solid, 3) + " ",
|
|
|
|
+ 50: Bar50 + strings.Repeat(BARS.Solid, 5) + " ",
|
|
|
|
+ 75: Bar75 + strings.Repeat(BARS.Solid, 7) + " ",
|
|
|
|
+ 90: Bar95 + strings.Repeat(BARS.Solid, 9) + " ",
|
|
|
|
+ 95: Bar95 + strings.Repeat(BARS.Solid, 9) + " ",
|
|
|
|
+ 100: Bar100 + strings.Repeat(BARS.Solid, 10) + "",
|
|
}
|
|
}
|
|
|
|
|
|
for pct, text := range BarSolid {
|
|
for pct, text := range BarSolid {
|
|
@@ -101,16 +101,16 @@ func testBars(t *testing.T) {
|
|
BarColor = ColorText("BLA ON WHI")
|
|
BarColor = ColorText("BLA ON WHI")
|
|
bar = BarLine{Line: Line{DefaultColor: BarColor}, Width: 10, Style: HALF_STEP, PercentStyle: PERCENT_SPACE}
|
|
bar = BarLine{Line: Line{DefaultColor: BarColor}, Width: 10, Style: HALF_STEP, PercentStyle: PERCENT_SPACE}
|
|
BarHalf := map[int]string{0: BarColor + " 0% ",
|
|
BarHalf := map[int]string{0: BarColor + " 0% ",
|
|
- 5: BarColor + BARS.half[1] + " 5% ",
|
|
|
|
- 6: BarColor + BARS.half[1] + " 6% ",
|
|
|
|
- 10: BarColor + BARS.half[0] + " 10% ",
|
|
|
|
- 20: BarColor + BARS.half[0] + BARS.half[0] + " 20% ",
|
|
|
|
- 25: BarColor + BARS.half[0] + BARS.half[0] + BARS.half[1] + " 25% ",
|
|
|
|
- 26: BarColor + BARS.half[0] + BARS.half[0] + BARS.half[1] + " 26% ",
|
|
|
|
- 50: BarColor + strings.Repeat(BARS.half[0], 3) + " 50% ",
|
|
|
|
- 75: BarColor + strings.Repeat(BARS.half[0], 3) + " 75% ",
|
|
|
|
- 90: BarColor + strings.Repeat(BARS.half[0], 3) + " 90% " + BARS.half[0] + " ",
|
|
|
|
- 100: BarColor + strings.Repeat(BARS.half[0], 3) + " 100 " + strings.Repeat(BARS.half[0], 2),
|
|
|
|
|
|
+ 5: BarColor + BARS.Half[1] + " 5% ",
|
|
|
|
+ 6: BarColor + BARS.Half[1] + " 6% ",
|
|
|
|
+ 10: BarColor + BARS.Half[0] + " 10% ",
|
|
|
|
+ 20: BarColor + BARS.Half[0] + BARS.Half[0] + " 20% ",
|
|
|
|
+ 25: BarColor + BARS.Half[0] + BARS.Half[0] + BARS.Half[1] + " 25% ",
|
|
|
|
+ 26: BarColor + BARS.Half[0] + BARS.Half[0] + BARS.Half[1] + " 26% ",
|
|
|
|
+ 50: BarColor + strings.Repeat(BARS.Half[0], 3) + " 50% ",
|
|
|
|
+ 75: BarColor + strings.Repeat(BARS.Half[0], 3) + " 75% ",
|
|
|
|
+ 90: BarColor + strings.Repeat(BARS.Half[0], 3) + " 90% " + BARS.Half[0] + " ",
|
|
|
|
+ 100: BarColor + strings.Repeat(BARS.Half[0], 3) + " 100 " + strings.Repeat(BARS.Half[0], 2),
|
|
}
|
|
}
|
|
|
|
|
|
for pct, text := range BarHalf {
|
|
for pct, text := range BarHalf {
|
|
@@ -124,15 +124,15 @@ func testBars(t *testing.T) {
|
|
BarColor = ColorText("RED")
|
|
BarColor = ColorText("RED")
|
|
bar = BarLine{Line: Line{DefaultColor: BarColor}, Width: 10, Style: GRADIENT}
|
|
bar = BarLine{Line: Line{DefaultColor: BarColor}, Width: 10, Style: GRADIENT}
|
|
BarGrad := map[int]string{0: BarColor + " ",
|
|
BarGrad := map[int]string{0: BarColor + " ",
|
|
- 3: BarColor + BARS.gradient[1] + " ",
|
|
|
|
- 5: BarColor + BARS.gradient[2] + " ",
|
|
|
|
- 8: BarColor + BARS.gradient[3] + " ",
|
|
|
|
- 10: BarColor + BARS.gradient[0] + " ",
|
|
|
|
- 20: BarColor + BARS.gradient[0] + BARS.gradient[0] + " ",
|
|
|
|
- 25: BarColor + BARS.gradient[0] + BARS.gradient[0] + BARS.gradient[2] + " ",
|
|
|
|
- 50: BarColor + strings.Repeat(BARS.gradient[0], 5) + " ",
|
|
|
|
- 75: BarColor + strings.Repeat(BARS.gradient[0], 7) + BARS.gradient[2] + " ",
|
|
|
|
- 100: BarColor + strings.Repeat(BARS.gradient[0], 10),
|
|
|
|
|
|
+ 3: BarColor + BARS.Gradient[1] + " ",
|
|
|
|
+ 5: BarColor + BARS.Gradient[2] + " ",
|
|
|
|
+ 8: BarColor + BARS.Gradient[3] + " ",
|
|
|
|
+ 10: BarColor + BARS.Gradient[0] + " ",
|
|
|
|
+ 20: BarColor + BARS.Gradient[0] + BARS.Gradient[0] + " ",
|
|
|
|
+ 25: BarColor + BARS.Gradient[0] + BARS.Gradient[0] + BARS.Gradient[2] + " ",
|
|
|
|
+ 50: BarColor + strings.Repeat(BARS.Gradient[0], 5) + " ",
|
|
|
|
+ 75: BarColor + strings.Repeat(BARS.Gradient[0], 7) + BARS.Gradient[2] + " ",
|
|
|
|
+ 100: BarColor + strings.Repeat(BARS.Gradient[0], 10),
|
|
}
|
|
}
|
|
|
|
|
|
var percent int64
|
|
var percent int64
|