fix move-range tests of moved-moved items

This commit is contained in:
Kevin Jahns
2022-06-16 20:23:34 +02:00
parent b63d22e7db
commit 44499cb9fe
3 changed files with 22 additions and 5 deletions

View File

@@ -563,10 +563,10 @@ const arrayTransactions = [
return
}
const pos = prng.int32(gen, 0, yarray.length - 1)
const len = prng.int32(gen, 1, math.min(1, yarray.length - pos))
const len = prng.int32(gen, 1, math.min(3, yarray.length - pos))
const _newPosAdj = prng.int32(gen, 0, yarray.length - len)
// make sure that we don't insert in-between the moved range
const newPos = _newPosAdj + (_newPosAdj > yarray.length - len ? len : 0)
const newPos = _newPosAdj + (_newPosAdj > pos ? len : 0)
const oldContent = yarray.toArray()
yarray.moveRange(pos, pos + len - 1, newPos)
const movedValues = oldContent.splice(pos, len)