Changed the signature of Bitmap.DirectAdd function

This commit is contained in:
Yuce Tekol 2018-09-17 17:10:02 +03:00
parent 266051dd26
commit 09c24cd3be
No known key found for this signature in database
GPG key ID: CB59E46D2FB90573
2 changed files with 3 additions and 3 deletions

View file

@ -168,7 +168,7 @@ func (b *Bitmap) Add(a ...uint64) (changed bool, err error) {
}
// DirectAdd adds values to the bitmap by bypassing the op log.
func (b *Bitmap) DirectAdd(values []uint64) {
func (b *Bitmap) DirectAdd(values ...uint64) {
for _, value := range values {
b.add(value)
}

View file

@ -334,8 +334,8 @@ func TestBitmap_ArrayCountRange(t *testing.T) {
func TestBitmap_DirectAdd(t *testing.T) {
bits := []uint64{0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16, 17, 1000000, 1000002, 1000003, 1000004, 1000005, 1000006, 1000010, 1000011, 1000012, 1000013, 1000014}
bm := roaring.NewBitmap()
bm.DirectAdd([]uint64{0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16, 17})
bm.DirectAdd([]uint64{1000000, 1000002, 1000003, 1000004, 1000005, 1000006, 1000010, 1000011, 1000012, 1000013, 1000014})
bm.DirectAdd(0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16, 17)
bm.DirectAdd(1000000, 1000002, 1000003, 1000004, 1000005, 1000006, 1000010, 1000011, 1000012, 1000013, 1000014)
if len(bits) != int(bm.Count()) {
t.Fatalf("count %d != %d", len(bits), bm.Count())
}