mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Unexport roaring.ContainerRun
This commit is contained in:
parent
bdd4fb51ef
commit
67cfe4dcee
3 changed files with 77 additions and 77 deletions
|
|
@ -57,8 +57,8 @@ const (
|
|||
//containerBitmap indicates a container of bits packed in a uint64 array block
|
||||
containerBitmap = byte(2)
|
||||
|
||||
//ContainerRun indicates a container of run encoded bits
|
||||
ContainerRun = byte(3)
|
||||
//containerRun indicates a container of run encoded bits
|
||||
containerRun = byte(3)
|
||||
|
||||
maxContainerVal = 0xffff
|
||||
)
|
||||
|
|
@ -657,7 +657,7 @@ func (b *Bitmap) UnmarshalBinary(data []byte) error {
|
|||
citer.Next()
|
||||
_, c := citer.Value()
|
||||
switch c.containerType {
|
||||
case ContainerRun:
|
||||
case containerRun:
|
||||
c.array = nil
|
||||
c.bitmap = nil
|
||||
runCount := binary.LittleEndian.Uint16(data[offset : offset+runCountHeaderSize])
|
||||
|
|
@ -1053,7 +1053,7 @@ func (c *Container) isBitmap() bool {
|
|||
|
||||
// isRun returns true if the container is a run-length-encoded container.
|
||||
func (c *Container) isRun() bool {
|
||||
return c.containerType == ContainerRun
|
||||
return c.containerType == containerRun
|
||||
}
|
||||
|
||||
// unmap creates copies of the containers data in the heap.
|
||||
|
|
@ -1074,7 +1074,7 @@ func (c *Container) unmap() {
|
|||
tmp := make([]uint64, len(c.bitmap))
|
||||
copy(tmp, c.bitmap)
|
||||
c.bitmap = tmp
|
||||
case ContainerRun:
|
||||
case containerRun:
|
||||
tmp := make([]interval16, len(c.runs))
|
||||
copy(tmp, c.runs)
|
||||
c.runs = tmp
|
||||
|
|
@ -1325,7 +1325,7 @@ func (c *Container) optimize() {
|
|||
|
||||
var newType byte
|
||||
if runs <= RunMaxSize && runs <= c.n/2 {
|
||||
newType = ContainerRun
|
||||
newType = containerRun
|
||||
} else if c.n < ArrayMaxSize {
|
||||
newType = containerArray
|
||||
} else {
|
||||
|
|
@ -1336,13 +1336,13 @@ func (c *Container) optimize() {
|
|||
if c.isArray() {
|
||||
if newType == containerBitmap {
|
||||
c.arrayToBitmap()
|
||||
} else if newType == ContainerRun {
|
||||
} else if newType == containerRun {
|
||||
c.arrayToRun()
|
||||
}
|
||||
} else if c.isBitmap() {
|
||||
if newType == containerArray {
|
||||
c.bitmapToArray()
|
||||
} else if newType == ContainerRun {
|
||||
} else if newType == containerRun {
|
||||
c.bitmapToRun()
|
||||
}
|
||||
} else if c.isRun() {
|
||||
|
|
@ -1551,7 +1551,7 @@ func (c *Container) runToBitmap() {
|
|||
|
||||
// bitmapToRun converts from bitmap format to RLE format.
|
||||
func (c *Container) bitmapToRun() {
|
||||
c.containerType = ContainerRun
|
||||
c.containerType = containerRun
|
||||
// return early if empty
|
||||
if c.n == 0 {
|
||||
c.runs = make([]interval16, 0)
|
||||
|
|
@ -1607,7 +1607,7 @@ func (c *Container) bitmapToRun() {
|
|||
|
||||
// arrayToRun converts from array format to RLE format.
|
||||
func (c *Container) arrayToRun() {
|
||||
c.containerType = ContainerRun
|
||||
c.containerType = containerRun
|
||||
// return early if empty
|
||||
if c.n == 0 {
|
||||
c.runs = make([]interval16, 0)
|
||||
|
|
@ -1664,7 +1664,7 @@ func (c *Container) Clone() *Container {
|
|||
case containerBitmap:
|
||||
other.bitmap = make([]uint64, len(c.bitmap))
|
||||
copy(other.bitmap, c.bitmap)
|
||||
case ContainerRun:
|
||||
case containerRun:
|
||||
other.runs = make([]interval16, len(c.runs))
|
||||
copy(other.runs, c.runs)
|
||||
}
|
||||
|
|
@ -2017,7 +2017,7 @@ func intersectArrayRun(a, b *Container) *Container {
|
|||
|
||||
// intersectRunRun computes the intersect of two run containers.
|
||||
func intersectRunRun(a, b *Container) *Container {
|
||||
output := &Container{containerType: ContainerRun}
|
||||
output := &Container{containerType: containerRun}
|
||||
na, nb := len(a.runs), len(b.runs)
|
||||
for i, j := 0, 0; i < na && j < nb; {
|
||||
va, vb := a.runs[i], b.runs[j]
|
||||
|
|
@ -2211,7 +2211,7 @@ func unionArrayRun(a, b *Container) *Container {
|
|||
if b.n == maxContainerVal+1 {
|
||||
return b.Clone()
|
||||
}
|
||||
output := &Container{containerType: ContainerRun}
|
||||
output := &Container{containerType: containerRun}
|
||||
na, nb := len(a.array), len(b.runs)
|
||||
var vb interval16
|
||||
var va uint16
|
||||
|
|
@ -2274,7 +2274,7 @@ func unionRunRun(a, b *Container) *Container {
|
|||
na, nb := len(a.runs), len(b.runs)
|
||||
output := &Container{
|
||||
runs: make([]interval16, 0, na+nb),
|
||||
containerType: ContainerRun,
|
||||
containerType: containerRun,
|
||||
}
|
||||
var va, vb interval16
|
||||
for i, j := 0, 0; i < na || j < nb; {
|
||||
|
|
@ -2405,7 +2405,7 @@ func (c *Container) equals(c2 *Container) bool {
|
|||
return false
|
||||
}
|
||||
}
|
||||
} else if c.containerType == ContainerRun {
|
||||
} else if c.containerType == containerRun {
|
||||
if len(c.runs) != len(c2.runs) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -2575,7 +2575,7 @@ func differenceRunArray(a, b *Container) *Container {
|
|||
if a.n == 0 || b.n == 0 {
|
||||
return a.Clone()
|
||||
}
|
||||
output := &Container{runs: make([]interval16, 0, len(a.runs)), containerType: ContainerRun}
|
||||
output := &Container{runs: make([]interval16, 0, len(a.runs)), containerType: containerRun}
|
||||
|
||||
bidx := 0
|
||||
vb := b.array[bidx]
|
||||
|
|
@ -2631,7 +2631,7 @@ func differenceRunBitmap(a, b *Container) *Container {
|
|||
if len(a.runs) > 0 && a.runs[0].start == 0 && a.runs[0].last == 65535 {
|
||||
return flipBitmap(b)
|
||||
}
|
||||
output := &Container{containerType: ContainerRun}
|
||||
output := &Container{containerType: containerRun}
|
||||
output.n = a.n
|
||||
if len(a.runs) == 0 {
|
||||
return output
|
||||
|
|
@ -2697,7 +2697,7 @@ func differenceRunRun(a, b *Container) *Container {
|
|||
alen := len(a.runs)
|
||||
blen := len(b.runs)
|
||||
|
||||
output := &Container{runs: make([]interval16, 0, alen+blen), containerType: ContainerRun} // TODO allocate max then truncate? or something else
|
||||
output := &Container{runs: make([]interval16, 0, alen+blen), containerType: containerRun} // TODO allocate max then truncate? or something else
|
||||
// cardinality upper bound: sum of number of runs
|
||||
// each B-run could split an A-run in two, up to len(b.runs) times
|
||||
|
||||
|
|
@ -3079,7 +3079,7 @@ func (a *ErrorList) AppendWithPrefix(err error, prefix string) {
|
|||
|
||||
// xorArrayRun computes the exclusive or of an array and a run container.
|
||||
func xorArrayRun(a, b *Container) *Container {
|
||||
output := &Container{containerType: ContainerRun}
|
||||
output := &Container{containerType: containerRun}
|
||||
na, nb := len(a.array), len(b.runs)
|
||||
var vb interval16
|
||||
var va uint16
|
||||
|
|
@ -3248,7 +3248,7 @@ func xorRunRun(a, b *Container) *Container {
|
|||
if nb == 0 {
|
||||
return a.Clone()
|
||||
}
|
||||
output := &Container{containerType: ContainerRun}
|
||||
output := &Container{containerType: containerRun}
|
||||
|
||||
lastI, lastJ := -1, -1
|
||||
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ func doContainer(containerType byte, data interface{}) *Container {
|
|||
c.array = data.([]uint16)
|
||||
case containerBitmap:
|
||||
c.bitmap = data.([]uint64)
|
||||
case ContainerRun:
|
||||
case containerRun:
|
||||
c.runs = data.([]interval16)
|
||||
}
|
||||
c.n = c.count()
|
||||
|
|
@ -281,17 +281,17 @@ func setupContainerTests() map[byte]map[string]*Container {
|
|||
}
|
||||
|
||||
// run containers
|
||||
cts[ContainerRun] = map[string]*Container{
|
||||
"empty": doContainer(ContainerRun, runEmpty()),
|
||||
"full": doContainer(ContainerRun, runFull()),
|
||||
"firstBitSet": doContainer(ContainerRun, runFirstBitSet()),
|
||||
"lastBitSet": doContainer(ContainerRun, runLastBitSet()),
|
||||
"firstBitUnset": doContainer(ContainerRun, runFirstBitUnset()),
|
||||
"lastBitUnset": doContainer(ContainerRun, runLastBitUnset()),
|
||||
"innerBitsSet": doContainer(ContainerRun, runInnerBitsSet()),
|
||||
"outerBitsSet": doContainer(ContainerRun, runOuterBitsSet()),
|
||||
"oddBitsSet": doContainer(ContainerRun, runOddBitsSet()),
|
||||
"evenBitsSet": doContainer(ContainerRun, runEvenBitsSet()),
|
||||
cts[containerRun] = map[string]*Container{
|
||||
"empty": doContainer(containerRun, runEmpty()),
|
||||
"full": doContainer(containerRun, runFull()),
|
||||
"firstBitSet": doContainer(containerRun, runFirstBitSet()),
|
||||
"lastBitSet": doContainer(containerRun, runLastBitSet()),
|
||||
"firstBitUnset": doContainer(containerRun, runFirstBitUnset()),
|
||||
"lastBitUnset": doContainer(containerRun, runLastBitUnset()),
|
||||
"innerBitsSet": doContainer(containerRun, runInnerBitsSet()),
|
||||
"outerBitsSet": doContainer(containerRun, runOuterBitsSet()),
|
||||
"oddBitsSet": doContainer(containerRun, runOddBitsSet()),
|
||||
"evenBitsSet": doContainer(containerRun, runEvenBitsSet()),
|
||||
}
|
||||
|
||||
return cts
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func (c *Container) String() string {
|
|||
}
|
||||
|
||||
func TestRunAppendInterval(t *testing.T) {
|
||||
a := Container{containerType: ContainerRun}
|
||||
a := Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
base []interval16
|
||||
app interval16
|
||||
|
|
@ -82,7 +82,7 @@ func TestInterval16RunLen(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestContainerRunAdd(t *testing.T) {
|
||||
c := Container{runs: make([]interval16, 0), containerType: ContainerRun}
|
||||
c := Container{runs: make([]interval16, 0), containerType: containerRun}
|
||||
tests := []struct {
|
||||
op uint16
|
||||
exp []interval16
|
||||
|
|
@ -113,7 +113,7 @@ func TestContainerRunAdd(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestContainerRunAdd2(t *testing.T) {
|
||||
c := Container{runs: make([]interval16, 0), containerType: ContainerRun}
|
||||
c := Container{runs: make([]interval16, 0), containerType: containerRun}
|
||||
ret := c.add(0)
|
||||
if !ret {
|
||||
t.Fatalf("result of adding new bit should be true: %v", c.runs)
|
||||
|
|
@ -128,7 +128,7 @@ func TestContainerRunAdd2(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRunCountRange(t *testing.T) {
|
||||
c := Container{runs: make([]interval16, 0), containerType: ContainerRun}
|
||||
c := Container{runs: make([]interval16, 0), containerType: containerRun}
|
||||
cnt := c.runCountRange(2, 9)
|
||||
if cnt != 0 {
|
||||
t.Fatalf("should get 0 from empty container, but got: %v", cnt)
|
||||
|
|
@ -181,7 +181,7 @@ func TestRunCountRange(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRunContains(t *testing.T) {
|
||||
c := Container{runs: make([]interval16, 0), containerType: ContainerRun}
|
||||
c := Container{runs: make([]interval16, 0), containerType: containerRun}
|
||||
if c.runContains(5) {
|
||||
t.Fatalf("empty run container should not contain 5")
|
||||
}
|
||||
|
|
@ -301,7 +301,7 @@ func TestIntersectionCountArrayBitmap2(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRunRemove(t *testing.T) {
|
||||
c := Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: ContainerRun}
|
||||
c := Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: containerRun}
|
||||
tests := []struct {
|
||||
op uint16
|
||||
exp []interval16
|
||||
|
|
@ -335,7 +335,7 @@ func TestRunRemove(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRunMax(t *testing.T) {
|
||||
c := Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: ContainerRun}
|
||||
c := Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: containerRun}
|
||||
max := c.max()
|
||||
if max != 16 {
|
||||
t.Fatalf("max for %v should be 16", c.runs)
|
||||
|
|
@ -350,7 +350,7 @@ func TestRunMax(t *testing.T) {
|
|||
|
||||
func TestIntersectionCountArrayRun(t *testing.T) {
|
||||
a := &Container{containerType: containerArray, array: []uint16{1, 5, 10, 11, 12}}
|
||||
b := &Container{containerType: ContainerRun, runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}}
|
||||
b := &Container{containerType: containerRun, runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}}
|
||||
|
||||
ret := intersectionCountArrayRun(a, b)
|
||||
if ret != 3 {
|
||||
|
|
@ -360,7 +360,7 @@ func TestIntersectionCountArrayRun(t *testing.T) {
|
|||
|
||||
func TestIntersectionCountBitmapRun(t *testing.T) {
|
||||
a := &Container{containerType: containerBitmap, bitmap: []uint64{0x8000000000000000}}
|
||||
b := &Container{containerType: ContainerRun, runs: []interval16{{start: 63, last: 64}}}
|
||||
b := &Container{containerType: containerRun, runs: []interval16{{start: 63, last: 64}}}
|
||||
|
||||
ret := intersectionCountBitmapRun(a, b)
|
||||
if ret != 1 {
|
||||
|
|
@ -368,7 +368,7 @@ func TestIntersectionCountBitmapRun(t *testing.T) {
|
|||
}
|
||||
|
||||
a = &Container{containerType: containerBitmap, bitmap: []uint64{0xF0000001, 0xFF00000000000000, 0xFF000000000000F0, 0x0F0000}}
|
||||
b = &Container{containerType: ContainerRun, runs: []interval16{{start: 29, last: 31}, {start: 125, last: 134}, {start: 191, last: 197}, {start: 200, last: 300}}}
|
||||
b = &Container{containerType: containerRun, runs: []interval16{{start: 29, last: 31}, {start: 125, last: 134}, {start: 191, last: 197}, {start: 200, last: 300}}}
|
||||
|
||||
ret = intersectionCountBitmapRun(a, b)
|
||||
if ret != 14 {
|
||||
|
|
@ -416,8 +416,8 @@ func TestIntersectionCountRunRun(t *testing.T) {
|
|||
bruns: []interval16{{start: 9, last: 9}, {start: 11, last: 17}}, exp: 6},
|
||||
}
|
||||
for i, test := range tests {
|
||||
a.containerType = ContainerRun
|
||||
b.containerType = ContainerRun
|
||||
a.containerType = containerRun
|
||||
b.containerType = containerRun
|
||||
a.runs = test.aruns
|
||||
b.runs = test.bruns
|
||||
ret := intersectionCountRunRun(a, b)
|
||||
|
|
@ -459,7 +459,7 @@ func TestIntersectArrayRun(t *testing.T) {
|
|||
|
||||
for i, test := range tests {
|
||||
a.containerType = containerArray
|
||||
b.containerType = ContainerRun
|
||||
b.containerType = containerRun
|
||||
a.array = test.array
|
||||
b.runs = test.runs
|
||||
ret := intersectArrayRun(a, b)
|
||||
|
|
@ -516,8 +516,8 @@ func TestIntersectRunRun(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for i, test := range tests {
|
||||
a.containerType = ContainerRun
|
||||
b.containerType = ContainerRun
|
||||
a.containerType = containerRun
|
||||
b.containerType = containerRun
|
||||
a.runs = test.aruns
|
||||
b.runs = test.bruns
|
||||
ret := intersectRunRun(a, b)
|
||||
|
|
@ -582,7 +582,7 @@ func TestIntersectBitmapRunBitmap(t *testing.T) {
|
|||
exp[i] = v
|
||||
}
|
||||
a.containerType = containerBitmap
|
||||
b.containerType = ContainerRun
|
||||
b.containerType = containerRun
|
||||
ret := intersectBitmapRun(a, b)
|
||||
if ret.isArray() {
|
||||
ret.arrayToBitmap()
|
||||
|
|
@ -643,7 +643,7 @@ func TestIntersectBitmapRunArray(t *testing.T) {
|
|||
}
|
||||
b.runs = test.runs
|
||||
a.containerType = containerBitmap
|
||||
b.containerType = ContainerRun
|
||||
b.containerType = containerRun
|
||||
ret := intersectBitmapRun(a, b)
|
||||
if !reflect.DeepEqual(ret.array, test.exp) {
|
||||
t.Fatalf("test #%v expected %v, but got %v", i, test.exp, ret.array)
|
||||
|
|
@ -672,7 +672,7 @@ func TestUnionMixed(t *testing.T) {
|
|||
// run container
|
||||
r := &Container{}
|
||||
r.runs = []interval16{{start: 5, last: 10}}
|
||||
r.containerType = ContainerRun
|
||||
r.containerType = containerRun
|
||||
r.n = 6
|
||||
|
||||
t.Run("various container Unions", func(t *testing.T) {
|
||||
|
|
@ -713,7 +713,7 @@ func TestIntersectMixed(t *testing.T) {
|
|||
|
||||
a.runs = []interval16{{start: 5, last: 10}}
|
||||
a.n = 6
|
||||
a.containerType = ContainerRun
|
||||
a.containerType = containerRun
|
||||
b.array = []uint16{1, 4, 5, 7, 10, 11, 12}
|
||||
b.n = 7
|
||||
b.containerType = containerArray
|
||||
|
|
@ -762,7 +762,7 @@ func TestDifferenceMixed(t *testing.T) {
|
|||
|
||||
a.runs = []interval16{{start: 5, last: 10}}
|
||||
a.n = a.runCountRange(0, 100)
|
||||
a.containerType = ContainerRun
|
||||
a.containerType = containerRun
|
||||
|
||||
b.array = []uint16{0, 2, 4, 6, 8, 10, 12}
|
||||
b.n = len(b.array)
|
||||
|
|
@ -885,8 +885,8 @@ func TestUnionRunRun(t *testing.T) {
|
|||
for i, test := range tests {
|
||||
a.runs = test.aruns
|
||||
b.runs = test.bruns
|
||||
a.containerType = ContainerRun
|
||||
b.containerType = ContainerRun
|
||||
a.containerType = containerRun
|
||||
b.containerType = containerRun
|
||||
ret := unionRunRun(a, b)
|
||||
if !reflect.DeepEqual(ret.runs, test.exp) {
|
||||
t.Fatalf("test #%v expected %v, but got %v", i, test.exp, ret.runs)
|
||||
|
|
@ -928,7 +928,7 @@ func TestUnionArrayRun(t *testing.T) {
|
|||
a.array = test.array
|
||||
b.runs = test.runs
|
||||
a.containerType = containerArray
|
||||
b.containerType = ContainerRun
|
||||
b.containerType = containerRun
|
||||
ret := unionArrayRun(a, b)
|
||||
if !reflect.DeepEqual(ret.array, test.exp) {
|
||||
t.Fatalf("test #%v expected %v, but got %v", i, test.exp, ret.array)
|
||||
|
|
@ -1039,7 +1039,7 @@ func TestBitmapToArray(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRunToBitmap(t *testing.T) {
|
||||
a := &Container{containerType: ContainerRun}
|
||||
a := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
runs []interval16
|
||||
exp []uint64
|
||||
|
|
@ -1205,7 +1205,7 @@ func TestArrayToRun(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRunToArray(t *testing.T) {
|
||||
a := &Container{containerType: ContainerRun}
|
||||
a := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
runs []interval16
|
||||
exp []uint16
|
||||
|
|
@ -1284,7 +1284,7 @@ func TestBitmapZeroRange(t *testing.T) {
|
|||
|
||||
func TestUnionBitmapRun(t *testing.T) {
|
||||
a := &Container{containerType: containerBitmap, bitmap: make([]uint64, bitmapN)}
|
||||
b := &Container{containerType: ContainerRun}
|
||||
b := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
bitmap []uint64
|
||||
runs []interval16
|
||||
|
|
@ -1414,7 +1414,7 @@ func TestArrayCountRuns(t *testing.T) {
|
|||
|
||||
func TestDifferenceArrayRun(t *testing.T) {
|
||||
a := &Container{containerType: containerArray}
|
||||
b := &Container{containerType: ContainerRun}
|
||||
b := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
array []uint16
|
||||
runs []interval16
|
||||
|
|
@ -1439,7 +1439,7 @@ func TestDifferenceArrayRun(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDifferenceRunArray(t *testing.T) {
|
||||
a := &Container{containerType: ContainerRun}
|
||||
a := &Container{containerType: containerRun}
|
||||
b := &Container{containerType: containerArray}
|
||||
tests := []struct {
|
||||
runs []interval16
|
||||
|
|
@ -1520,7 +1520,7 @@ func MakeLastBitSet() []uint64 {
|
|||
}
|
||||
|
||||
func TestDifferenceRunBitmap(t *testing.T) {
|
||||
a := &Container{containerType: ContainerRun}
|
||||
a := &Container{containerType: containerRun}
|
||||
b := &Container{containerType: containerBitmap, bitmap: make([]uint64, bitmapN)}
|
||||
tests := []struct {
|
||||
runs []interval16
|
||||
|
|
@ -1584,7 +1584,7 @@ func TestDifferenceRunBitmap(t *testing.T) {
|
|||
|
||||
func TestDifferenceBitmapRun(t *testing.T) {
|
||||
a := &Container{containerType: containerBitmap, bitmap: make([]uint64, bitmapN)}
|
||||
b := &Container{containerType: ContainerRun}
|
||||
b := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
bitmap []uint64
|
||||
runs []interval16
|
||||
|
|
@ -1746,8 +1746,8 @@ func TestDifferenceBitmapBitmap(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDifferenceRunRun(t *testing.T) {
|
||||
a := &Container{containerType: ContainerRun}
|
||||
b := &Container{containerType: ContainerRun}
|
||||
a := &Container{containerType: containerRun}
|
||||
b := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
aruns []interval16
|
||||
bruns []interval16
|
||||
|
|
@ -1852,7 +1852,7 @@ func TestWriteReadFullBitmap(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestWriteReadRun(t *testing.T) {
|
||||
cr := &Container{runs: []interval16{{start: 3, last: 13}, {start: 100, last: 109}}, n: 21, containerType: ContainerRun}
|
||||
cr := &Container{runs: []interval16{{start: 3, last: 13}, {start: 100, last: 109}}, n: 21, containerType: containerRun}
|
||||
br := NewFileBitmap()
|
||||
br.Containers.Put(0, cr)
|
||||
br2 := NewFileBitmap()
|
||||
|
|
@ -1878,19 +1878,19 @@ func TestXorArrayRun(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
a: &Container{array: []uint16{1, 5, 10, 11, 12}, containerType: containerArray},
|
||||
b: &Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: ContainerRun},
|
||||
b: &Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: containerRun},
|
||||
exp: &Container{array: []uint16{1, 2, 3, 4, 6, 7, 8, 9, 11, 13, 15, 16}, containerType: containerArray, n: 12},
|
||||
}, {
|
||||
a: &Container{array: []uint16{1, 5, 10, 11, 12, 13, 14}, containerType: containerArray},
|
||||
b: &Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: ContainerRun},
|
||||
b: &Container{runs: []interval16{{start: 2, last: 10}, {start: 12, last: 13}, {start: 15, last: 16}}, containerType: containerRun},
|
||||
exp: &Container{array: []uint16{1, 2, 3, 4, 6, 7, 8, 9, 11, 14, 15, 16}, containerType: containerArray, n: 12},
|
||||
}, {
|
||||
a: &Container{array: []uint16{65535}, containerType: containerArray},
|
||||
b: &Container{runs: []interval16{{start: 65534, last: 65535}}, containerType: ContainerRun},
|
||||
b: &Container{runs: []interval16{{start: 65534, last: 65535}}, containerType: containerRun},
|
||||
exp: &Container{array: []uint16{65534}, containerType: containerArray, n: 1},
|
||||
}, {
|
||||
a: &Container{array: []uint16{65535}, containerType: containerArray},
|
||||
b: &Container{runs: []interval16{{start: 65535, last: 65535}}, containerType: ContainerRun},
|
||||
b: &Container{runs: []interval16{{start: 65535, last: 65535}}, containerType: containerRun},
|
||||
exp: &Container{array: []uint16{}, containerType: containerArray, n: 0},
|
||||
},
|
||||
}
|
||||
|
|
@ -1912,8 +1912,8 @@ func TestXorArrayRun(t *testing.T) {
|
|||
|
||||
//special case that didn't fit the xorrunrun table testing below.
|
||||
func TestXorRunRun1(t *testing.T) {
|
||||
a := &Container{containerType: ContainerRun}
|
||||
b := &Container{containerType: ContainerRun}
|
||||
a := &Container{containerType: containerRun}
|
||||
b := &Container{containerType: containerRun}
|
||||
a.runs = []interval16{{start: 4, last: 10}}
|
||||
b.runs = []interval16{{start: 5, last: 10}}
|
||||
ret := xorRunRun(a, b)
|
||||
|
|
@ -1927,8 +1927,8 @@ func TestXorRunRun1(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestXorRunRun(t *testing.T) {
|
||||
a := &Container{containerType: ContainerRun}
|
||||
b := &Container{containerType: ContainerRun}
|
||||
a := &Container{containerType: containerRun}
|
||||
b := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
aruns []interval16
|
||||
bruns []interval16
|
||||
|
|
@ -2094,7 +2094,7 @@ func TestBitmapXorRange(t *testing.T) {
|
|||
|
||||
func TestXorBitmapRun(t *testing.T) {
|
||||
a := &Container{containerType: containerBitmap}
|
||||
b := &Container{containerType: ContainerRun}
|
||||
b := &Container{containerType: containerRun}
|
||||
tests := []struct {
|
||||
bitmap []uint64
|
||||
runs []interval16
|
||||
|
|
@ -2722,13 +2722,13 @@ func TestContainerCombinations(t *testing.T) {
|
|||
|
||||
cts := setupContainerTests()
|
||||
|
||||
containerTypes := []byte{containerArray, containerBitmap, ContainerRun}
|
||||
containerTypes := []byte{containerArray, containerBitmap, containerRun}
|
||||
|
||||
// map used for a more descriptive print
|
||||
cm := map[byte]string{
|
||||
containerArray: "array",
|
||||
containerBitmap: "bitmap",
|
||||
ContainerRun: "run",
|
||||
containerRun: "run",
|
||||
}
|
||||
|
||||
testOps := []testOp{
|
||||
|
|
@ -3224,7 +3224,7 @@ func TestContainerCombinations(t *testing.T) {
|
|||
if !reflect.DeepEqual(clone.bitmap, cts[ct][exp].bitmap) {
|
||||
t.Fatalf("test %s expected bitmap %X, but got %X", desc, cts[ct][exp].bitmap, clone.bitmap)
|
||||
}
|
||||
} else if ct == ContainerRun {
|
||||
} else if ct == containerRun {
|
||||
if clone.isArray() {
|
||||
clone.arrayToRun()
|
||||
} else if clone.isBitmap() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue