simplify TestBarCompleted
Vladimir Bauer
4 years ago
| 18 | 18 | total := 80 |
| 19 | 19 | bar := p.AddBar(int64(total)) |
| 20 | 20 | |
| 21 | var count int | |
| 22 | for !bar.Completed() { | |
| 23 | time.Sleep(10 * time.Millisecond) | |
| 24 | bar.Increment() | |
| 25 | count++ | |
| 26 | } | |
| 27 | ||
| 28 | p.Wait() | |
| 29 | if count != total { | |
| 30 | t.Errorf("got count: %d, expected %d\n", count, total) | |
| 31 | } | |
| 21 | for i := 0; i < total; i++ { | |
| 22 | bar.Increment() | |
| 23 | } | |
| 24 | ||
| 25 | if !bar.Completed() { | |
| 26 | t.Error("bar isn't completed") | |
| 27 | } | |
| 28 | ||
| 29 | p.Wait() | |
| 32 | 30 | } |
| 33 | 31 | |
| 34 | 32 | func TestBarID(t *testing.T) { |