MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / TestAdd

Function TestAdd

BitSliceIndexing/bsi_test.go:326–341  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

324}
325
326func TestAdd(t *testing.T) {
327 bsi := NewDefaultBSI()
328 // Setup values
329 for i := 1; i <= 10; i++ {
330 bsi.SetValue(uint64(i), int64(i))
331 }
332 clone := bsi.Clone()
333 bsi.Add(clone)
334 assert.Equal(t, uint64(10), bsi.GetCardinality())
335 for i := 1; i <= 10; i++ {
336 a, _ := bsi.GetValue(uint64(i))
337 b, _ := clone.GetValue(uint64(i))
338 assert.Equal(t, b*2, a)
339 }
340
341}
342
343func TestIncrement(t *testing.T) {
344 bsi := setup()

Callers

nothing calls this directly

Calls 6

NewDefaultBSIFunction · 0.70
SetValueMethod · 0.45
CloneMethod · 0.45
AddMethod · 0.45
GetCardinalityMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…