fix circlic move-loops

This commit is contained in:
Kevin Jahns
2022-04-04 15:35:23 +02:00
parent b32f88cd40
commit e8ecc8f74b
4 changed files with 93 additions and 6 deletions

View File

@@ -512,6 +512,23 @@ export const testMove2 = tc => {
compare(users)
}
/**
* @param {t.TestCase} tc
*/
export const testMoveCircles = tc => {
const { testConnector, array0, array1 } = init(tc, { users: 3 })
array0.insert(0, [1, 2, 3, 4])
testConnector.flushAllMessages()
array0.moveRange(0, 1, 3)
t.compare(array0.toArray(), [3, 1, 2, 4])
array1.moveRange(2, 3, 1)
t.compare(array1.toArray(), [1, 3, 4, 2])
testConnector.flushAllMessages()
t.assert(array0.length === 4)
t.assert(array0.length === array0.toArray().length)
t.compareArrays(array0.toArray(), array1.toArray())
}
/**
* @param {t.TestCase} tc
*/