@terrencecrowley/ot-js
Version:
Javascript OT library
126 lines (103 loc) • 13.8 kB
JSON
{ "tests": [
// 1 = OpIinsert
// 2 = OpDdelete
// 3 = OpRretain
// 4 = OpCcursor
// 5 = OpSet
// 0: Retain + 3
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ] ] } ] },
// 1: Insert + Insert
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "456" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 1, 3, "456" ] ] } ] },
// 2: Delete + Delete
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ ] } ] },
// 3: Insert + Delete
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 4, "1234" ], [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 4, "1234" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 4, "" ], [ 2, 3, "" ] ] } ] },
// 4: I,R + D,I
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 1, "" ], [ 1, 2, "45" ], [ 3, 2, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 3, 4, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 2, 1, "" ], [ 1, 2, "45" ], [ 3, 2, "" ] ] } ] },
// 5: Random regression
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "0" ], [ 3, 8, "" ], [ 2, 1, "" ], [ 2, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 4, 0, "" ], [ 1, 4, "0123" ], [ 3, 7, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "0" ], [ 3, 9, "" ], [ 2, 2, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 1, "" ], [ 2, 3, "" ], [ 4, 0, "" ], [ 1, 4, "0123" ], [ 3, 5, "" ] ] } ] },
// 6: Random regression
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 2, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 1, 5, "01234" ], [ 2, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 14, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 1, 5, "01234" ] ] } ] },
// 7: Random regression
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 2, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 4, 0, "" ], [ 4, 0, "" ], [ 3, 7, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 6, "" ], [ 2, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 4, 0, "" ], [ 3, 6, "" ] ] } ] },
// 8: Inserts and 2s interacting
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 1, "" ], [ 1, 1, "0" ], [ 3, 2, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "1" ], [ 2, 1, "" ], [ 3, 2, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "0" ], [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 1, "" ], [ 1, 1, "1" ], [ 3, 2, "" ] ] } ] },
// 9: More 1s and 2s interacting
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 4, "" ], [ 1, 4, "0000" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "1" ], [ 4, 0, "" ], [ 1, 1, "2" ], [ 2, 4, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 4, "0000" ], [ 3, 2, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 4, "" ], [ 3, 4, "" ], [ 1, 1, "1" ], [ 4, 0, "" ], [ 1, 1, "2" ] ] } ] },
// 10: More 1s and 2s interacting (reverse of above - changes server priority for ambiguous 1s)
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "1" ], [ 4, 0, "" ], [ 1, 1, "2" ], [ 2, 4, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 4, "" ], [ 1, 4, "0000" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "1" ], [ 4, 0, "" ], [ 1, 1, "2" ], [ 2, 4, "" ], [ 3, 4, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 2, "" ], [ 1, 4, "0000" ] ] } ] },
// 11: More 1s and 2s interacting - simplest case
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 1, "" ], [ 1, 1, "0" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "1" ], [ 2, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "0" ], [ 3, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 1, "" ], [ 3, 1, "" ], [ 1, 1, "1" ] ] } ] },
// 12: Conflicting 1s confused by 2s
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 5, "0a0a0" ], [ 2, 3, "" ], [ 1, 4, "00a0" ], [ 3, 7, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 2, "1b" ], [ 2, 1, "" ], [ 4, 0, "" ], [ 3, 9, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 9, "0a0a000a0" ], [ 3, 2, "" ], [ 2, 2, "" ], [ 3, 7, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 1, 2, "1b" ], [ 4, 0, "" ], [ 3, 7, "" ] ] } ] },
// 13: Random regression
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 1, 5, "0a0a0" ], [ 2, 1, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 6, "" ], [ 2, 2, "" ], [ 1, 3, "1b1" ], [ 2, 2, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 6, "" ], [ 1, 5, "0a0a0" ], [ 3, 3, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 6, "" ], [ 2, 3, "" ], [ 3, 5, "" ], [ 1, 3, "1b1" ] ] } ] },
// 14: Set regression case
{"resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 16, ".328.329.330.331"], [ 2, 12,""] ] } ] },
{"resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 20, ".332.333.334.335.336" ], [ 5, 8, ".337.338"], [ 3, 4, "" ] ] } ] },
{"resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 16, ".328.329.330.331"], [ 3, 20, "" ], [ 2, 12, "" ] ] } ] },
{"resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 16, "" ], [ 1, 20, ".332.333.334.335.336"] ] } ] },
// 15: Another 5 regression
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 5, 4, ".428"], [ 4, 0, "" ], [ 2, 8, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 5, 4, ".429" ], [ 2, 8, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 5, 4, ".429"], [ 4, 0, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 5, 4, ".429" ] ] } ] },
// 16: Another 5 regression
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 5, 4, ".245" ], [ 1, 8, ".246.247" ], [ 2, 4, "" ], [ 5, 4, ".248" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 5, 4, ".249" ], [ 2, 8, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 5, 4, ".249" ], [ 1, 8, ".246.247" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 5, 4, ".249" ], [3, 8, "" ], [ 2, 4, "" ] ] } ] },
// 17: Another 5 regression
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 32, ".383.384.385.386.387.388.389.390" ], [ 5, 12, ".391.392.393" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 4, "" ], [ 1, 8, ".394.395" ], [ 2, 8, "" ] ] } ] },
{ "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 32, ".383.384.385.386.387.388.389.390" ], [ 5, 4, ".391" ], [ 3, 8, "" ] ] } ] },
{ "resourceID": "0", "clientID": "1", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 36, "" ], [ 2, 8, "" ], [ 1, 8, ".394.395" ] ] } ] },
// 18: Insert/Delete regression
{"resourceID": "0", "clientID":"0","clock":0,"edits":[{"resourceName":"0","underlyingType": "string", "edits": [ [1,8,".394.395"],[2,8,""],[1,16,".396.397.398.399"],[2,4,""]]} ] },
{"resourceID": "0", "clientID":"1","clock":0,"edits":[{"resourceName":"0","underlyingType": "string", "edits": [ [1,28,".400.401.402.403.404.405.406"],[3,8,""],[1,4,".407"],[5,4,".408"]]} ] },
{"resourceID": "0", "clientID":"0","clock":0,"edits":[{"resourceName":"0","underlyingType": "string", "edits": [ [1,24,".394.395.396.397.398.399"],[3,28,""],[2,8,""],[3,4,""],[2,4,""]]} ] },
{"resourceID": "0", "clientID":"1","clock":0,"edits":[{"resourceName":"0","underlyingType": "string", "edits": [ [3,24,""],[1,32,".400.401.402.403.404.405.406.407"]]}]}
]
}