Codebase list golang-github-vbauerster-mpb / 7e61637
test update Vladimir Bauer 9 years ago
1 changed file(s) with 9 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
22 import "testing"
33
44 func TestAddBar(t *testing.T) {
5 p := New()
5 p := New().SetWidth(60)
66 count := p.BarsCount()
77 if count != 0 {
88 t.Errorf("Count want: %q, got: %q\n", 0, count)
99 }
10 p.AddBar(10)
10 p.Wg.Add(1)
11 bar := p.AddBar(10)
1112 count = p.BarsCount()
1213 if count != 1 {
1314 t.Errorf("Count want: %q, got: %q\n", 0, count)
1415 }
16 for i := 0; i < 10; i++ {
17 bar.Incr(1)
18 }
19 p.WaitAndStop()
1520 }
1621
1722 func TestRemoveBar(t *testing.T) {
1823 p := New()
24 p.Wg.Add(1)
1925 b := p.AddBar(10)
2026
2127 if !p.RemoveBar(b) {
2632 if count != 0 {
2733 t.Errorf("Count want: %q, got: %q\n", 0, count)
2834 }
35 p.WaitAndStop()
2936 }