diff --git a/roaring.go b/roaring.go index 5a2dbebd..dd8e6f19 100644 --- a/roaring.go +++ b/roaring.go @@ -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(",") } diff --git a/roaring_test.go b/roaring_test.go index 234ed355..2a862237 100644 --- a/roaring_test.go +++ b/roaring_test.go @@ -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() {