(t *testing.T)
| 814 | } |
| 815 | |
| 816 | func 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 - |
| 856 | func BenchmarkFromBitmap16(b *testing.B) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…