Skip to content

Commit

Permalink
fix bitarray/IsEmpty()
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Jan 2, 2016
1 parent 0f802a9 commit 75c27ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bitarray/bitarray.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (ba *bitArray) Blocks() Iterator {
}

func (ba *bitArray) IsEmpty() bool {
return ba.anyset
return !ba.anyset
}

// complement flips all bits in this array.
Expand Down
8 changes: 8 additions & 0 deletions bitarray/bitarray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ func TestOutOfBounds(t *testing.T) {
}
}

func TestIsEmpty(t *testing.T) {
ba := newBitArray(10)
assert.True(t, ba.IsEmpty())

ba.SetBit(5)
assert.False(t, ba.IsEmpty())
}

func TestClear(t *testing.T) {
ba := newBitArray(10)

Expand Down

0 comments on commit 75c27ff

Please sign in to comment.