-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/test/e2e-emulated/__snapshots__/map-comparison.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`map-comparison should implement map comparison correctly 1`] = ` | ||
[ | ||
{ | ||
"$seq": 0, | ||
"events": [ | ||
{ | ||
"$type": "deploy", | ||
}, | ||
{ | ||
"$type": "received", | ||
"message": { | ||
"body": { | ||
"cell": "x{602DB8CDE_} | ||
x{CFF} | ||
x{500000000000000000000000000000000000000000000000000000000000000014_} | ||
x{500000000000000000000000000000000000000000000000000000000000000024_} | ||
x{CFF} | ||
x{500000000000000000000000000000000000000000000000000000000000000014_} | ||
x{500000000000000000000000000000000000000000000000000000000000000024_}", | ||
"type": "cell", | ||
}, | ||
"bounce": true, | ||
"from": "@treasure(treasure)", | ||
"to": "kQB_fk7kQdo5QXLBsDT5CiTCeaSICOBKsOIkviCSYGKxbfgw", | ||
"type": "internal", | ||
"value": "10", | ||
}, | ||
}, | ||
{ | ||
"$type": "failed", | ||
"errorCode": 9, | ||
"errorMessage": "Cell underflow", | ||
}, | ||
{ | ||
"$type": "sent-bounced", | ||
"message": { | ||
"body": { | ||
"cell": "x{FFFFFFFF602DB8CDE_}", | ||
"type": "cell", | ||
}, | ||
"bounce": false, | ||
"from": "kQB_fk7kQdo5QXLBsDT5CiTCeaSICOBKsOIkviCSYGKxbfgw", | ||
"to": "@treasure(treasure)", | ||
"type": "internal", | ||
"value": "9.996081", | ||
}, | ||
}, | ||
], | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Dictionary, toNano } from "@ton/core"; | ||
import { ContractSystem } from "@tact-lang/emulator"; | ||
import { __DANGER_resetNodeId } from "../../grammar/ast"; | ||
import { MapComparisonTestContract } from "./contracts/output/map-comparison_MapComparisonTestContract"; | ||
|
||
describe("map-comparison", () => { | ||
beforeEach(() => { | ||
__DANGER_resetNodeId(); | ||
}); | ||
it("should implement map comparison correctly", async () => { | ||
// Init | ||
const system = await ContractSystem.create(); | ||
const treasure = system.treasure("treasure"); | ||
const contract = system.open( | ||
await MapComparisonTestContract.fromInit(), | ||
); | ||
const tracker = system.track(contract.address); | ||
|
||
// Test | ||
{ | ||
const m1: Dictionary<bigint, bigint> = Dictionary.empty( | ||
Dictionary.Keys.BigInt(256), | ||
Dictionary.Values.BigInt(256), | ||
); | ||
m1.set(1n, 2n); | ||
m1.set(3n, 4n); | ||
const m2: Dictionary<bigint, bigint> = Dictionary.empty( | ||
Dictionary.Keys.BigInt(256), | ||
Dictionary.Values.BigInt(256), | ||
); | ||
m2.set(1n, 2n); | ||
m2.set(3n, 4n); | ||
await contract.send( | ||
treasure, | ||
{ value: toNano("10") }, | ||
{ | ||
$$type: "CompareIntInt", | ||
m1, | ||
m2, | ||
}, | ||
); | ||
await system.run(); | ||
expect(tracker.collect()).toMatchSnapshot(); | ||
} | ||
}); | ||
}); |