MCPcopy
hub / github.com/RoaringBitmap/roaring / TestSerializationBasic2_041

Function TestSerializationBasic2_041

serialization_test.go:218–237  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

216}
217
218func TestSerializationBasic2_041(t *testing.T) {
219 rb := BitmapOf(1, 2, 3, 4, 5, 100, 1000, 10000, 100000, 1000000)
220 buf := &bytes.Buffer{}
221 sz := rb.GetSerializedSizeInBytes()
222 ub := BoundSerializedSizeInBytes(rb.GetCardinality(), 1000001)
223
224 assert.False(t, sz > ub+10)
225
226 l := int(rb.GetSerializedSizeInBytes())
227 _, err := rb.WriteTo(buf)
228
229 require.NoError(t, err)
230 assert.Equal(t, l, buf.Len())
231
232 newrb := NewBitmap()
233 _, err = newrb.ReadFrom(buf)
234
235 require.NoError(t, err)
236 assert.True(t, rb.Equals(newrb))
237}
238
239func TestFromUnsafeBytes(t *testing.T) {
240 rb := BitmapOf(1, 2, 3, 4, 5, 100, 1000, 10000, 100000, 1000000)

Callers

nothing calls this directly

Calls 9

ReadFromMethod · 0.95
BitmapOfFunction · 0.70
NewBitmapFunction · 0.70
GetCardinalityMethod · 0.45
WriteToMethod · 0.45
LenMethod · 0.45
EqualsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…