Skip to content

Commit

Permalink
remove unnecessary test
Browse files Browse the repository at this point in the history
  • Loading branch information
JanLewDev committed Sep 13, 2024
1 parent 8b33a20 commit 0cefd47
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions packages/object/tests/hashgraph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,70 +317,6 @@ describe("HashGraph for PseudoRandomWinsSet tests", () => {
obj5 = new TopologyObject("peer5", new PseudoRandomWinsSet<number>());
});

test("Test: Giga Chad case", () => {
/*
__ V6:ADD(3)
/
___ V2:ADD(1) <-- V3:RM(2) <-- V7:RM(1) <-- V8:RM(3)
/ ______________/
V1:ADD(1)/ /
\ /
\ ___ V4:RM(2) <-- V5:ADD(2) <-- V9:RM(1)
*/

const cro1 = obj1.cro as PseudoRandomWinsSet<number>;
const cro2 = obj2.cro as PseudoRandomWinsSet<number>;
const cro3 = obj3.cro as PseudoRandomWinsSet<number>;

cro1.add(1);
obj2.merge(obj1.hashGraph.getAllVertices());

cro1.add(1);
cro1.remove(2);
cro2.remove(2);
cro2.add(2);

obj3.merge(obj1.hashGraph.getAllVertices());
cro3.add(3);
cro1.remove(1);

obj1.merge(obj2.hashGraph.getAllVertices());
cro1.remove(3);
cro2.remove(1);

obj1.merge(obj2.hashGraph.getAllVertices());
obj1.merge(obj3.hashGraph.getAllVertices());
obj2.merge(obj1.hashGraph.getAllVertices());
obj2.merge(obj3.hashGraph.getAllVertices());
obj3.merge(obj1.hashGraph.getAllVertices());
obj3.merge(obj2.hashGraph.getAllVertices());

expect(obj1.hashGraph.vertices).toEqual(obj2.hashGraph.vertices);
expect(obj1.hashGraph.vertices).toEqual(obj3.hashGraph.vertices);

const linearOpsObj1 = obj1.hashGraph.linearizeOperations();
const linearOpsObj2 = obj2.hashGraph.linearizeOperations();
const linearOpsObj3 = obj3.hashGraph.linearizeOperations();
expect(linearOpsObj1).toEqual(linearOpsObj2);
expect(linearOpsObj1).toEqual(linearOpsObj3);

/*
Resolving conflicts:
1. V2, V4 => V4 is chosen
2. V3, V4 => V3 is chosen
3. V3, V5 => V3 is chosen
4. V3, V9 => V3 is chosen
5. V6, V7 => V6 is chosen
6. V6, V8 => V8 is chosen
Final order: V1, V3, V8
*/
expect(linearOpsObj1).toEqual([
{ type: "add", value: 1 },
{ type: "remove", value: 2 },
{ type: "remove", value: 3 },
]);
});

test("Test: Many concurrent operations", () => {
/*
--- V1:ADD(1)
Expand Down

0 comments on commit 0cefd47

Please sign in to comment.