algorithms-go/DataStructure/bitmap/bitmap_test.go
2021-04-07 18:13:02 +08:00

21 lines
378 B
Go

package bitmap
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestNewBitMap(t *testing.T) {
max := 100
b := NewBitMap(max)
b.Add(13)
b.Add(100)
b.Add(0)
assert.Equal(t, true, b.IsExist(13))
assert.Equal(t, true, b.IsExist(0))
assert.Equal(t, true, b.IsExist(100))
b.Remove(13)
assert.Equal(t, false, b.IsExist(13))
assert.Equal(t, max, b.Max())
}