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

Function TestSerializationFromJava051

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

Source from the content-addressed store, hash-verified

158}
159
160func TestSerializationFromJava051(t *testing.T) {
161 fname := "testdata/bitmapwithoutruns.bin"
162 newrb := NewBitmap()
163 fin, err := os.Open(fname)
164 if err != nil {
165 fmt.Fprintf(os.Stderr, "\n\nIMPORTANT: For testing file IO, the roaring library requires disk access.\nWe omit some tests for now.\n\n")
166 return
167 }
168
169 defer func() {
170 fin.Close()
171 }()
172
173 _, _ = newrb.ReadFrom(fin)
174 t.Log(newrb.GetCardinality())
175 rb := NewBitmap()
176 for k := uint32(0); k < 100000; k += 1000 {
177 rb.Add(k)
178 }
179 for k := uint32(100000); k < 200000; k++ {
180 rb.Add(3 * k)
181 }
182 for k := uint32(700000); k < 800000; k++ {
183 rb.Add(k)
184 }
185
186 assert.True(t, rb.Equals(newrb))
187}
188
189func TestSerializationFromJavaWithRuns052(t *testing.T) {
190 fname := "testdata/bitmapwithruns.bin"

Callers

nothing calls this directly

Calls 5

ReadFromMethod · 0.95
GetCardinalityMethod · 0.95
AddMethod · 0.95
EqualsMethod · 0.95
NewBitmapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…