Codebase list golang-github-vbauerster-mpb / 92c3ad9 progress_test.go
92c3ad9

Tree @92c3ad9 (Download .tar.gz)

progress_test.go @92c3ad9raw · history · blame

package mpb

import "testing"

func TestAddBar(t *testing.T) {
	p := New()
	count := p.BarsCount()
	if count != 0 {
		t.Errorf("Count want: %q, got: %q\n", 0, count)
	}
	p.AddBar(10)
	count = p.BarsCount()
	if count != 1 {
		t.Errorf("Count want: %q, got: %q\n", 0, count)
	}
}

func TestRemoveBar(t *testing.T) {
	p := New()
	b := p.AddBar(10)

	if !p.RemoveBar(b) {
		t.Error("RemoveBar failure")
	}

	count := p.BarsCount()
	if count != 0 {
		t.Errorf("Count want: %q, got: %q\n", 0, count)
	}
}