Skip to content

Commit ceab3d4

Browse files
committed
rlei_test: don't assume iand or ior are always in-place
In TestRle16RandomInplaceIntersectAgainstOtherContainers014 and in TestAllContainerMethodsAllContainerTypesWithData067 don't assume that an `iand` or `ior` will be inplace. It's best effort. Sometimes the resulting container can be of a different type.
1 parent 01d244c commit ceab3d4

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

rlei_test.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,13 @@ func TestRle16RandomInplaceIntersectAgainstOtherContainers014(t *testing.T) {
402402
// vs runContainer
403403
rcb := newRunContainer16FromVals(false, b...)
404404

405-
rcVsBcIsect := rc.Clone()
406-
rcVsAcIsect := rc.Clone()
407-
rcVsRcbIsect := rc.Clone()
405+
var rcVsBcIsect container = rc.Clone()
406+
var rcVsAcIsect container = rc.Clone()
407+
var rcVsRcbIsect container = rc.Clone()
408408

409-
rcVsBcIsect.iand(bc)
410-
rcVsAcIsect.iand(ac)
411-
rcVsRcbIsect.iand(rcb)
409+
rcVsBcIsect = rcVsBcIsect.iand(bc)
410+
rcVsAcIsect = rcVsAcIsect.iand(ac)
411+
rcVsRcbIsect = rcVsRcbIsect.iand(rcb)
412412

413413
p("rcVsBcIsect is %v", rcVsBcIsect)
414414
p("rcVsAcIsect is %v", rcVsAcIsect)
@@ -1603,7 +1603,6 @@ type twofer struct {
16031603
}
16041604

16051605
func TestAllContainerMethodsAllContainerTypesWithData067(t *testing.T) {
1606-
16071606
Convey("each of the container methods that takes two containers should handle all 3x3==9 possible ways of being called -- and return results that agree with each other", t, func() {
16081607

16091608
//rleVerbose = true
@@ -1687,6 +1686,14 @@ func TestAllContainerMethodsAllContainerTypesWithData067(t *testing.T) {
16871686

16881687
z := c1.name
16891688

1689+
// In-place operation are best effort
1690+
// User should not assume the receiver is modified, returned container has to be used
1691+
if strings.HasPrefix(z, "i") {
1692+
c1.cn = res1
1693+
c2.cn = res2
1694+
c3.cn = res3
1695+
}
1696+
16901697
if strings.HasPrefix(z, "lazy") {
16911698
// on purpose, the lazy functions
16921699
// do not scan to update their cardinality

0 commit comments

Comments
 (0)