-
Notifications
You must be signed in to change notification settings - Fork 121
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
5 changed files
with
94 additions
and
20 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
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,28 @@ | ||
import { toNano } from "@ton/core"; | ||
import { ContractSystem } from "@tact-lang/emulator"; | ||
import { __DANGER_resetNodeId } from "../grammar/ast"; | ||
import { PrecendenceTester } from "./features/output/precendence_PrecendenceTester"; | ||
|
||
describe("feature-precendence", () => { | ||
beforeEach(() => { | ||
__DANGER_resetNodeId(); | ||
}); | ||
it("should implement precendence of operations correctly", async () => { | ||
// Init | ||
const system = await ContractSystem.create(); | ||
const treasure = system.treasure("treasure"); | ||
const contract = system.open(await PrecendenceTester.fromInit()); | ||
await contract.send( | ||
treasure, | ||
{ value: toNano("10") }, | ||
{ $$type: "Deploy", queryId: 0n }, | ||
); | ||
await system.run(); | ||
|
||
// Check methods | ||
expect(await contract.getTest1()).toEqual(12n); | ||
expect(await contract.getTest2()).toEqual(4n); | ||
expect(await contract.getTest3()).toEqual(12n); | ||
expect(await contract.getTest4()).toEqual(12n); | ||
}); | ||
}); |
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,23 @@ | ||
import "@stdlib/deploy"; | ||
|
||
contract PrecendenceTester with Deployable { | ||
init() { | ||
|
||
} | ||
|
||
get fun test1(): Int { | ||
return 5 & 6 | 1 << 5 + 11 * 3 % 12 >> 11; | ||
} | ||
|
||
get fun test2(): Int { | ||
return 5 & 6 | 1 << (5 + 11) * 3 % 12 >> 11; | ||
} | ||
|
||
get fun test3(): Int { | ||
return 5 & 6 | 1 << 5 + 11 * (3 % 12) >> 35; | ||
} | ||
|
||
get fun test4(): Int { | ||
return 5 & 6 | 1 << 5 + (11 * 3) % 12 >> 11; | ||
} | ||
} |
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