Skip to content

Commit

Permalink
Merge pull request #124 from brentp/isempty
Browse files Browse the repository at this point in the history
fix bitarray/IsEmpty()
  • Loading branch information
alexandercampbell-wk committed Jan 4, 2016
2 parents 0f802a9 + 75c27ff commit 074c32b
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 074c32b

Please sign in to comment.