ops tests
This commit is contained in:
Родитель
0661ff8866
Коммит
becec27259
|
@ -7,6 +7,7 @@ import * as RedBlack from "./redBlack";
|
|||
import BTree from "./btree";
|
||||
import * as random from "random-js";
|
||||
import * as ITree from "./intervalSpanningTree";
|
||||
import * as CollabString from "./ops";
|
||||
|
||||
function compareStrings(a: string, b: string) {
|
||||
return a.localeCompare(b);
|
||||
|
@ -420,6 +421,39 @@ function itreeCheckedTest() {
|
|||
|
||||
}
|
||||
|
||||
class TestClient {
|
||||
constructor(public id: number, public text:string, public testService: TestService) {
|
||||
|
||||
}
|
||||
testInsert(pos: number, s: string) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TestService {
|
||||
todoIndex = 0;
|
||||
ops: CollabString.Op[] = [];
|
||||
clients: TestClient[] = [];
|
||||
|
||||
msg(op: CollabString.Op) {
|
||||
this.ops.push(op);
|
||||
this.process();
|
||||
}
|
||||
|
||||
process() {
|
||||
let outOps: CollabString.Op[]=[];
|
||||
for (let i=this.todoIndex, len = this.ops.length;i<len;i++) {
|
||||
let op = this.ops[i];
|
||||
if (i>this.todoIndex) {
|
||||
|
||||
}
|
||||
else {
|
||||
outOps.push(op);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//simpleTest();
|
||||
//fileTest1();
|
||||
|
|
Загрузка…
Ссылка в новой задаче