roaringarray.writeTo and .readFrom should serialize and unserialize when containing all 3 container types
(t *testing.T)
| 147 | |
| 148 | // roaringarray.writeTo and .readFrom should serialize and unserialize when containing all 3 container types |
| 149 | func TestSerializationBasic3_042(t *testing.T) { |
| 150 | rb := BitmapOf(1, 2, 3, 4, 5, 100, 1000, 10000, 100000, 1000000, maxUint32+10, maxUint32<<10) |
| 151 | for i := uint64(maxUint32); i < maxUint32+2*(1<<16); i++ { |
| 152 | rb.Add(i) |
| 153 | } |
| 154 | |
| 155 | var buf bytes.Buffer |
| 156 | _, err := rb.WriteTo(&buf) |
| 157 | |
| 158 | require.NoError(t, err) |
| 159 | assert.EqualValues(t, buf.Len(), int(rb.GetSerializedSizeInBytes())) |
| 160 | data := buf.Bytes() |
| 161 | |
| 162 | newrb := NewBitmap() |
| 163 | _, err = newrb.ReadFrom(&buf) |
| 164 | |
| 165 | require.NoError(t, err) |
| 166 | assert.True(t, newrb.Equals(rb)) |
| 167 | |
| 168 | newrb2 := NewBitmap() |
| 169 | fromUnsafeBytesChecked(t, newrb2, data) |
| 170 | assert.True(t, rb.Equals(newrb2)) |
| 171 | } |
| 172 | |
| 173 | func TestHoldReference(t *testing.T) { |
| 174 | t.Run("Test Hold Reference", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…