Skip to content

Commit

Permalink
move tests to math, fix changelog, add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusarich committed Apr 19, 2024
1 parent d942751 commit 82a11dc
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 60 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `@stdlib/stoppable` now imports `@stdlib/ownable` so the programmer does not have to do it separately: PR [#193](https://github.com/tact-lang/tact/pull/193)
- Support escape sequences for strings (`\\`, `\"`, `\n`, `\r`, `\t`, `\v`, `\b`, `\f`, `\u{0}` through `\u{FFFFFF}`, `\u0000` through `\uFFFF`, `\x00` through `\xFF`): PR [#192](https://github.com/tact-lang/tact/pull/192)
- `newAddress` function now evaluates to a constant value if possible: PR [#237](https://github.com/tact-lang/tact/pull/237)
- Operation precendence now matches with JavaScript rules: PR [#265](https://github.com/tact-lang/tact/pull/265)

### Fixed

- Incorrect "already exists" errors when using names such as `toString` or `valueOf`: PR [#208](https://github.com/tact-lang/tact/pull/208)
- Escape backticks in error messages for generated TypeScript code: PR [#192](https://github.com/tact-lang/tact/pull/192)
- Empty inherited trait lists after `with` keyword are now disallowed: PR [#246](https://github.com/tact-lang/tact/pull/246)
- Allow chaining method calls with `!!`, for instance, `map.asCell()!!.hash()` is grammatically correct now: PR [#257](ttps://github.com/tact-lang/tact/pull/257)
- Operation precendence for bitwise operators, equality and comparisons now matches common languages, like JavaScript: PR [#265](https://github.com/tact-lang/tact/pull/265)

## [1.2.0] - 2024-02-29

Expand Down
9 changes: 9 additions & 0 deletions src/test/feature-math.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,14 @@ describe("feature-math", () => {
);
}
}

// Test operation precendence

expect(await contract.getPrecendence1()).toBe(12n);
expect(await contract.getPrecendence2()).toBe(4n);
expect(await contract.getPrecendence3()).toBe(12n);
expect(await contract.getPrecendence4()).toBe(12n);
expect(await contract.getPrecendence5()).toBe(5n);
expect(await contract.getPrecendence6()).toBe(0n);
});
});
28 changes: 0 additions & 28 deletions src/test/feature-precendence.spec.ts

This file was deleted.

24 changes: 24 additions & 0 deletions src/test/features/math.tact
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,28 @@ contract MathTester with Deployable {
get fun log(num: Int, base: Int): Int {
return log(num, base);
}

get fun precendence1(): Int {
return 5 & 6 | 1 << 5 + 11 * 3 % 12 >> 11;
}

get fun precendence2(): Int {
return 5 & 6 | 1 << (5 + 11) * 3 % 12 >> 11;
}

get fun precendence3(): Int {
return 5 & 6 | 1 << 5 + 11 * (3 % 12) >> 35;
}

get fun precendence4(): Int {
return 5 & 6 | 1 << 5 + (11 * 3) % 12 >> 11;
}

get fun precendence5(): Int {
return 5 | 6 & 8;
}

get fun precendence6(): Int {
return (5 | 6) & 8;
}
}
23 changes: 0 additions & 23 deletions src/test/features/precendence.tact

This file was deleted.

8 changes: 0 additions & 8 deletions tact.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,6 @@
"debug": true
}
},
{
"name": "precendence",
"path": "./src/test/features/precendence.tact",
"output": "./src/test/features/output",
"options": {
"debug": true
}
},
{
"name": "ternary",
"path": "./src/test/features/ternary.tact",
Expand Down

0 comments on commit 82a11dc

Please sign in to comment.