1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[FunC] Enrich testing framework, add code hash checking

@code_hash to match (boc) hash of compiled.fif against expected.
While being much less flexible than @fif_codegen, it nevertheless
gives a guarantee of bytecode stability on compiler modifications.
This commit is contained in:
Aleksandr Kirsanov 2024-04-27 14:32:16 +05:00
parent 18050a7591
commit c74e49d467
No known key found for this signature in database
GPG key ID: B758BBAA01FFB3D3
10 changed files with 105 additions and 2 deletions

View file

@ -86,4 +86,6 @@ int main() {
{-
method_id | in | out
TESTCASE | 0 | | 31415926535897932384626433832795028841971693993751058209749445923078164
@code_hash 84337043972311674339187056298873613816389434478842780265748859098303774481976
-}

View file

@ -61,6 +61,15 @@ global int xx;
return (xx, xx~inc(xx / 20), xx, xx = xx * 2, xx, xx += 1, xx);
}
(int, int, int, int, int) test_if_else(int x) method_id(20) {
if (x > 10) {
return (x~inc(8), x + 1, x = 1, x <<= 3, x);
} else {
xx = 9;
return (x, x~inc(-4), x~inc(-1), x >= 1, x = x + xx);
}
}
() main() {
}
@ -75,4 +84,8 @@ TESTCASE | 16 | 100 | 100 50 105 210 210 211 211
TESTCASE | 17 | 100 | 100 50 105 210 210 211 211
TESTCASE | 18 | 100 | 210 210 211 211 100 50 105
TESTCASE | 19 | 100 | 100 50 105 210 210 211 211
TESTCASE | 20 | 80 | 80 89 1 8 8
TESTCASE | 20 | 9 | 9 -40 -10 -1 13
@code_hash 67078680159561921827850021610104736412668316252257881932102553152922274405210
-}

View file

@ -110,4 +110,6 @@ TESTCASE | 23 | | [ 11 22 33 ] [ 220 330 110 ]
TESTCASE | 24 | | [ 11 22 33 44 55 ] [ 220 330 440 110 550 ]
TESTCASE | 25 | | [ 22 33 ] [ 220 330 ]
TESTCASE | 26 | | [ 11 22 33 ] [ 220 330 110 ]
@code_hash 53895312198338603934600244087571743055624960603383611438828666636202841531600
-}

View file

@ -57,4 +57,6 @@ _ main() {
{-
TESTCASE | 0 | | 0
@code_hash 98157584761932576648981760908342408003231747902562138202913714302941716912743
-}

View file

@ -51,4 +51,6 @@ _ main() {
{-
TESTCASE | 0 | | 0
@code_hash 35542701048549611407499491204004197688673151742407097578098250360682143458214
-}

View file

@ -106,4 +106,6 @@ TESTCASE | 4 | 4 8 9 | 4350009
TESTCASE | 4 | 4 7 9 | 4001009
TESTCASE | 5 | 4 8 9 | 4350009
TESTCASE | 5 | 4 7 9 | 4001009
@code_hash 30648920105446086409127767431349650306796188362733360847851465122919640638913
-}

View file

@ -32,4 +32,6 @@ TESTCASE | 0 | -5 -4 | 111 -70
TESTCASE | 0 | -4 3 | -7 40
TESTCASE | 0 | -4 -5 | -7 1110
TESTCASE | 0 | -4 -4 | -7 -70
@code_hash 68625253347714662162648433047986779710161195298061582217368558479961252943991
-}

View file

@ -14,4 +14,6 @@ int main(int x) {
{-
method_id | in | out
TESTCASE | 0 | 0 | 1
@code_hash 36599880583276393028571473830850694081778552118303309411432666239740650614479
-}