Skip to content

Commit

Permalink
Testing stringer, and avoiding negative values for large integers.
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Aug 22, 2016
1 parent 3e24f42 commit 425f11c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion roaring.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (rb *Bitmap) String() string {
buffer.WriteString("...")
break
}
buffer.WriteString(strconv.Itoa(int(i.Next())))
buffer.WriteString(strconv.FormatInt(int64(i.Next()), 10))
if i.HasNext() { // todo: optimize
buffer.WriteString(",")
}
Expand Down
9 changes: 9 additions & 0 deletions roaring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import (
"strconv"
"testing"
)
func TestStringer(t *testing.T) {
v := NewBitmap()
for i := uint32(0); i < 10; i++ {
v.Add(i)
}
if v.String() != "{0,1,2,3,4,5,6,7,8,9}" {
t.Error("bad string output")
}
}

func TestFastCard(t *testing.T) {
Convey("fast card", t, func() {
Expand Down

0 comments on commit 425f11c

Please sign in to comment.