progress_test
Vladimir Bauer
9 years ago
| 0 | package mpb | |
| 1 | ||
| 2 | import "testing" | |
| 3 | ||
| 4 | func TestAddBar(t *testing.T) { | |
| 5 | p := New() | |
| 6 | count := p.BarsCount() | |
| 7 | if count != 0 { | |
| 8 | t.Errorf("Count want: %q, got: %q\n", 0, count) | |
| 9 | } | |
| 10 | p.AddBar(10) | |
| 11 | count = p.BarsCount() | |
| 12 | if count != 1 { | |
| 13 | t.Errorf("Count want: %q, got: %q\n", 0, count) | |
| 14 | } | |
| 15 | } | |
| 16 | ||
| 17 | func TestRemoveBar(t *testing.T) { | |
| 18 | p := New() | |
| 19 | b := p.AddBar(10) | |
| 20 | ||
| 21 | if !p.RemoveBar(b) { | |
| 22 | t.Error("RemoveBar failure") | |
| 23 | } | |
| 24 | ||
| 25 | count := p.BarsCount() | |
| 26 | if count != 0 { | |
| 27 | t.Errorf("Count want: %q, got: %q\n", 0, count) | |
| 28 | } | |
| 29 | } |