UNPKG

@terrencecrowley/ot-js

Version:
156 lines (124 loc) 15.9 kB
{ "tests": [ // "Op":1 = OpInsert // "Op":2 = OpDelete // "Op":3 = OpRetain // "Op":4 = OpCursor // "Op":5 = OpSet // 0: Retain + "retain" { "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 + "retain" { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ] ] } ] }, { "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": [ [ 1, 3, "123" ] ] } ] }, // 2: Retain + Trailing Insert { "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, 3, "123" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 1, 3, "123" ] ] } ] }, // 3: Retain + Leading Insert { "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": [ [ 1, 3, "123" ], [ 3, 3, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 3, 3, "" ] ] } ] }, // 4: Insert + Insert { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 1, 4, "1234" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 7, "1231234" ] ] } ] }, // 5: Insert + Cursor { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 7, "1231234" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 4, 0, "" ], [ 3, 4, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 4, 0, "" ], [ 1, 4, "1234" ] ] } ] }, // 6: Retain + Delete { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 4, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 1, "" ] ] } ] }, // 7: Delete + Retain { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 1, "" ] ] } ] }, // 8: Delete + Delete { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 4, "" ] ] } ] }, // 9: Delete + Insert { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "1" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 1, 1, "1" ], [ 3, 1, "" ] ] } ] }, // 10: Insert + Delete { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "1" ], [ 3, 4, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 2, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 2, "" ], [ 3, 2, "" ] ] } ] }, // 11: Insert + Delete { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 4, "1234" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 3, 2, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "4" ], [ 3, 1, "" ] ] } ] }, // 12: Insert + Delete { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 4, "1234" ], [ 3, 3, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 5, "" ], [ 3, 2, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 1, "" ], [ 3, 2, "" ] ] } ] }, // 13: Insert,Delete + Delete { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 1, 2, "12" ], [ 3, 3, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 4, "" ], [ 3, 4, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 3, "" ], [ 1, 1, "2" ], [ 3, 3, "" ] ] } ] }, // 14: Insert,Delete + Delete { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 2, "12" ], [ 2, 3, "" ], [ 3, 3, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 4, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 5, "" ], [ 3, 1, "" ] ] } ] }, // 15: Cursor involvement { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 4, 0, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 4, 0, "" ], [ 1, 2, "45" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 4, 0, "" ], [ 1, 2, "45" ] ] } ] }, // 16: Cursor involvement { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 4, 0, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 3, "" ], [ 4, 0, "" ], [ 1, 2, "45" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "123" ], [ 4, 0, "" ], [ 1, 2, "45" ] ] } ] }, // 17: Random regression { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 4, 0, "" ], [ 1, 2, "01" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "012" ], [ 1, 2, "01" ], [ 3, 1, "" ], [ 1, 5, "01234" ], [ 2, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 11, "01201001234" ] ] } ] }, // 18: Random regression { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 4, "0123" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 2, "" ], [ 1, 1, "0" ], [ 4, 0, "" ], [ 1, 5, "01234" ], [ 3, 2, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 3, "010" ], [ 4, 0, "" ], [ 1, 7, "0123423" ] ] } ] }, // 19: Random regression { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 10, "" ], [ 1, 5, "01234" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 3, 4, "" ], [ 2, 1, "" ], [ 2, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 10, "" ], [ 1, 3, "012" ] ] } ] }, // 20: Random regression { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 6, "" ], [ 3, 4, "" ], [ 1, 2, "01" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 4, 0, "" ], [ 3, 3, "" ], [ 1, 5, "01234" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 9, "" ], [ 4, 0, "" ], [ 3, 1, "" ], [ 1, 7, "0101234" ] ] } ] }, // 21: Random regression { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 2, "01" ], [ 3, 6, "" ], [ 3, 3, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 3, 10, "" ], [ 2, 1, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 2, "01" ], [ 3, 8, "" ], [ 2, 1, "" ], [ 3, 1, "" ] ] } ] }, // 22: Sequence of compositions { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 1, "0" ], [ 4, 0, "" ], [ 1, 2, "0a" ], [ 3, 3, "" ], [ 2, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 2, 3, "" ], [ 3, 2, "" ], [ 2, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 3, 2, "" ], [ 2, 2, "" ] ] } ] }, // 23: Continued sequence { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 3, 2, "" ], [ 2, 2, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 5, "00a0a" ], [ 2, 2, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 5, "00a0a" ], [ 2, 4, "" ] ] } ] }, // 24: Continued sequence { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 5, "00a0a" ], [ 2, 4, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 4, "0a0a" ], [ 3, 4, "" ], [ 4, 0, "" ], [ 1, 1, "0" ], [ 2, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 8, "0a0a00a0" ], [ 4, 0, "" ], [ 1, 1, "0" ], [ 2, 4, "" ] ] } ] }, // 25: Continued sequence { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 1, 8, "0a0a00a0" ], [ 4, 0, "" ], [ 1, 1, "0" ], [ 2, 5, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 1, 4, "0a0a" ], [ 2, 2, "" ], [ 3, 5, "" ], [ 4, 0, "" ], [ 1, 5, "0a0a0" ], [ 2, 1, "" ], [ 3, 1, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 1, 9, "0a0a0a00a" ], [ 4, 0, "" ], [ 1, 6, "0a0a00" ], [ 2, 5, "" ] ] } ] }, // 26: Some examples with Set { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 2, 8, "" ], [ 5, 4, ".113" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 5, 4, ".114" ], [ 4, 0, "" ], [ 1, 16, ".115.116.117.118" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 8, "" ], [ 4, 0, "" ], [ 5, 4, ".114" ], [ 4, 0, "" ], [ 1, 16, ".115.116.117.118" ] ] } ] }, // 27: Cursor + Cursor { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "c1" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "c2" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "c1" ], [ 4, 0, "c2" ] ] } ] }, // 28: More Set examples { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 4, "" ], [ 4, 0, "" ], [ 3, 4, "" ], [ 2, 4, "" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 4, 0, "" ], [ 5, 4, ".487" ], [ 4, 0, "" ], [ 1, 16, ".488.489.490.491" ] ] } ] }, { "resourceID": "0", "clientID": "0", "clock": 0, "edits": [ { "resourceName": "0", "underlyingType": "string", "edits": [ [ 2, 4, "" ], [ 4, 0, "" ], [ 5, 4, ".487" ], [ 2, 4, "" ], [ 4, 0, "" ], [ 1, 16, ".488.489.490.491" ] ] } ] } ] }