fix all remaining bugs for single-item moves (mainly event bugs)

This commit is contained in:
Kevin Jahns
2022-04-04 13:10:43 +02:00
parent 51c095ec52
commit b32f88cd40
6 changed files with 118 additions and 104 deletions

View File

@@ -540,20 +540,6 @@ const getUniqueNumber = () => _uniqueNumber++
* @todo to replace content to a separate data structure so we know that insert & returns work as expected!!!
*/
const arrayTransactions = [
function move (user, gen) {
const yarray = user.getArray('array')
if (yarray.length === 0) {
return
}
const pos = prng.int32(gen, 0, yarray.length - 1)
const newPos = prng.int32(gen, 0, yarray.length)
const oldContent = yarray.toArray()
yarray.move(pos, newPos)
const [x] = oldContent.splice(pos, 1)
oldContent.splice(pos < newPos ? newPos - 1 : newPos, 0, x)
t.compareArrays(yarray.toArray(), oldContent) // we want to make sure that fastSearch markers insert at the correct position
},
// @todo remove this duplicate!!
function move (user, gen) {
const yarray = user.getArray('array')
if (yarray.length === 0) {
@@ -671,6 +657,13 @@ export const testRepeatGeneratingYarrayTests6 = tc => {
compareTestobjects(applyRandomTests(tc, arrayTransactions, 6, monitorArrayTestObject))
}
/**
* @param {t.TestCase} tc
*/
export const testRepeatGeneratingYarrayTests10 = tc => {
compareTestobjects(applyRandomTests(tc, arrayTransactions, 10, monitorArrayTestObject))
}
/**
* @param {t.TestCase} tc
*/