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

Function TestRleStoringMax16

runcontainer_test.go:816–853  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

814}
815
816func TestRleStoringMax16(t *testing.T) {
817 t.Run("Storing the MaxUint16 should be possible, because it may be necessary to do so--users will assume that any valid uint16 should be storable. In particular the smaller 16-bit version will definitely expect full access to all bits.", func(t *testing.T) {
818 rc := newRunContainer16()
819 rc.Add(MaxUint16)
820
821 assert.True(t, rc.contains(MaxUint16))
822 assert.EqualValues(t, 1, rc.getCardinality())
823
824 rc.removeKey(MaxUint16)
825
826 assert.False(t, rc.contains(MaxUint16))
827 assert.EqualValues(t, 0, rc.getCardinality())
828
829 rc.set(false, MaxUint16-1, MaxUint16)
830
831 assert.EqualValues(t, 2, rc.getCardinality())
832 assert.True(t, rc.contains(MaxUint16-1))
833 assert.True(t, rc.contains(MaxUint16))
834
835 rc.removeKey(MaxUint16 - 1)
836
837 assert.EqualValues(t, 1, rc.getCardinality())
838
839 rc.removeKey(MaxUint16)
840
841 assert.EqualValues(t, 0, rc.getCardinality())
842
843 rc.set(false, MaxUint16-2, MaxUint16-1, MaxUint16)
844
845 assert.EqualValues(t, 3, rc.getCardinality())
846 assert.EqualValues(t, 1, rc.numIntervals())
847
848 rc.removeKey(MaxUint16 - 1)
849
850 assert.EqualValues(t, 2, rc.numIntervals())
851 assert.EqualValues(t, 2, rc.getCardinality())
852 })
853}
854
855// go test -bench BenchmarkFromBitmap -run -
856func BenchmarkFromBitmap16(b *testing.B) {

Callers

nothing calls this directly

Calls 7

newRunContainer16Function · 0.85
removeKeyMethod · 0.80
setMethod · 0.80
numIntervalsMethod · 0.80
containsMethod · 0.65
getCardinalityMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…