Skip to content

Commit

Permalink
fix: objectset and tets
Browse files Browse the repository at this point in the history
  • Loading branch information
JanLewDev committed Feb 19, 2025
1 parent e5dd151 commit 18628a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion packages/object/src/linearize/pairSemantics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ export function linearizePairSemantics(
}
}
}

return result;
}
4 changes: 4 additions & 0 deletions packages/object/src/utils/objectSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ export class ObjectSet<T extends string | number | symbol> {
}

add(item: T): void {
if (this.has(item)) return;

this.set[item] = true;
this.size++;
}

delete(item: T): void {
if (!this.has(item)) return;

delete this.set[item];
this.size--;
}
Expand Down
11 changes: 4 additions & 7 deletions packages/object/tests/actiontypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ describe("Test: ActionTypes (Nop and Swap)", () => {
addMul.add(5);
drp.merge(drp2.vertices);
drp2.merge(drp.vertices);
vi.setSystemTime(new Date(Date.UTC(1998, 11, 21)));
addMul.mul(5);
vi.setSystemTime(new Date(Date.UTC(1998, 11, 22)));
addMul.add(5);
vi.setSystemTime(new Date(Date.UTC(1998, 11, 23)));
addMul2.add(5);
drp.merge(drp2.vertices);
drp2.merge(drp.vertices);
expect(addMul.query_value()).toBe(55);
expect(addMul2.query_value()).toBe(55);
expect(addMul.query_value()).toBe(75);
expect(addMul2.query_value()).toBe(75);

addMul2.mul(2);
vi.setSystemTime(new Date(Date.UTC(1998, 11, 24)));
Expand All @@ -109,8 +106,8 @@ describe("Test: ActionTypes (Nop and Swap)", () => {
addMul.mul(3);
drp.merge(drp2.vertices);
drp2.merge(drp.vertices);
expect(addMul.query_value()).toBe(510);
expect(addMul2.query_value()).toBe(510);
expect(addMul.query_value()).toBe(480);
expect(addMul2.query_value()).toBe(480);
});
});

Expand Down

0 comments on commit 18628a7

Please sign in to comment.