Added the actual bytes and their respective errors

This commit is contained in:
Ashley Svetlik 2019-06-14 10:05:06 -05:00
parent a1f6321b1d
commit 0a87d8108f

View file

@ -8,16 +8,24 @@ func TestUnmarshalBinary(t *testing.T) {
b := NewBitmap()
confirmedCrashers := []struct {
cr []byte
expected string
} {
{cr : []byte(":000000")},
{cr : []byte("<000000000000000")},
{
cr : []byte(":0\x000\x01\x00\x00\x000000"), //":000000"
expected : "reading roaring header: malformed bitmap, key-cardinality slice overruns buffer at 12",
},
{
cr : []byte("<0\x000\x00\x00\x00\x00000000000000" +
"0"), //"<000000000000000"
expected : "unmarshaling as pilosa roaring: too big",
},
}
for _, crash := range confirmedCrashers {
err := b.UnmarshalBinary(crash.cr)
if err != nil {
t.Error("Known crasher failed.")
}
if err.Error() != crash.expected {
t.Errorf("Expected: %s, Got: %s", crash.expected, err)
}
}
}