mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-23 02:01:54 +03:00
Generate expectations
This commit is contained in:
parent
1612bcccba
commit
bf49a0cc48
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:8:9\n |\n 8 | increment(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:9:9\n |\n 9 | increment(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:13:9\n |\n 13 | decrement(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:14:9\n |\n 14 | decrement(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372044]: Function must contain a `finalize` statement on all execution paths.\n --> compiler-test:12:5\n |\n 12 | inline bar() {\n 13 | decrement(values, 0u8, 1u8);\n 14 | decrement(account, self.caller, 1u64);\n 15 | }\n | ^\nError [ETYC0372031]: Only transition functions can have a `finalize` block.\n --> compiler-test:17:5\n |\n 17 | finalize finalize_no_params() {\n 18 | foo();\n 19 | bar();\n 20 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372045]: `finalize` name `bar` does not match function name `finalize_no_params`\n --> compiler-test:17:5\n |\n 17 | finalize finalize_no_params() {\n 18 | foo();\n 19 | bar();\n 20 | }\n | ^\nError [ETYC0372066]: Cyclic dependency between functions: `bar` --> `bar`\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:8:9\n |\n 8 | increment(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:9:9\n |\n 9 | increment(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:13:9\n |\n 13 | decrement(values, 0u8, 1u8);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372035]: `increment` or `decrement` statements must be inside a finalize block.\n --> compiler-test:14:9\n |\n 14 | decrement(account, self.caller, 1u64);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372044]: Function must contain a `finalize` statement on all execution paths.\n --> compiler-test:12:5\n |\n 12 | inline bar() {\n 13 | decrement(values, 0u8, 1u8);\n 14 | decrement(account, self.caller, 1u64);\n 15 | }\n | ^\nError [ETYC0372031]: Only transition functions can have a `finalize` block.\n --> compiler-test:17:5\n |\n 17 | finalize finalize_no_params() {\n 18 | foo();\n 19 | bar();\n 20 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372045]: `finalize` name `bar` does not match function name `finalize_no_params`\n --> compiler-test:17:5\n |\n 17 | finalize finalize_no_params() {\n 18 | foo();\n 19 | bar();\n 20 | }\n | ^\nError [ETYC0372066]: Cyclic dependency between functions: `bar` --> `bar`\n"
|
10
tests/expectations/compiler/finalize/inline_in_finalize.out
Normal file
10
tests/expectations/compiler/finalize/inline_in_finalize.out
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- initial_ast: 66c08e3fa6b22b7663e949d6ea72455bca2c26a573ba094f084310a086a4cf0b
|
||||
unrolled_ast: 66c08e3fa6b22b7663e949d6ea72455bca2c26a573ba094f084310a086a4cf0b
|
||||
ssa_ast: b86f0471ac1a09039a4ce147e87b0c41b9c3378dba0cb560b4a2fe41533781c2
|
||||
flattened_ast: 52f744a6cf805739c77995f73c2f626ad2403301c5dc6e007b9c2092869f5224
|
||||
inlined_ast: b7ef966c924c7fd055476fd974079af70e235aed43d8cbff30c7eadad8e342c7
|
||||
bytecode: 614bd1f31a52b5176e1c8a7b8a7fc17ced721ae71e50d33daa09ebc65b5fff20
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- initial_ast: d9f4c437725505b182331f81158f4d4fe868ac4c51bc09e7adb207668875c1d3
|
||||
unrolled_ast: d9f4c437725505b182331f81158f4d4fe868ac4c51bc09e7adb207668875c1d3
|
||||
ssa_ast: 52bde71da7f559a45cb7dff0b9ec4634cbca56d1d02dad9ade11cd733590d5e1
|
||||
flattened_ast: 47f2df48295953cd15343288c0ce7de1394e82e6c34734992397df74c1b2138a
|
||||
inlined_ast: 419b798e293216e127d3a3ed8775e39a5ab0c6cb2b0bfbcd69bbeffed7d0f113
|
||||
bytecode: d84ad59c8407d4d733886e7442e47de32cc3025f6e411d2cce0816ce30f0b488
|
@ -5,6 +5,6 @@ outputs:
|
||||
- initial_ast: ef14a0a65f3e5450826ec37f7e2369f0f2b8d3314ed00da3ec900d4a51ed4eb9
|
||||
unrolled_ast: ef14a0a65f3e5450826ec37f7e2369f0f2b8d3314ed00da3ec900d4a51ed4eb9
|
||||
ssa_ast: 608b9c426b08b8b97dcf7f6a14c7dd0ebca594a7e17f79580cd1274757c4dd3c
|
||||
flattened_ast: ad7ca8b81c6e95aa3bc15aa2b79004eb697635f8e884ae7eafd8dabbd134c8a4
|
||||
inlined_ast: ad7ca8b81c6e95aa3bc15aa2b79004eb697635f8e884ae7eafd8dabbd134c8a4
|
||||
flattened_ast: 7df8d7e0db134613ff120ee03cffc2fef159cf8204273668222e41d2b0efd2d1
|
||||
inlined_ast: 7df8d7e0db134613ff120ee03cffc2fef159cf8204273668222e41d2b0efd2d1
|
||||
bytecode: 2a939858f2f71f1bbe25bd039899cdb71254e56acc203eb6d60dbb5c191a4224
|
||||
|
@ -5,6 +5,6 @@ outputs:
|
||||
- initial_ast: 374f33d7c3329a997d7740cbbc7e79d2c52b4ab70f14c72e1e77e01789e4932c
|
||||
unrolled_ast: 374f33d7c3329a997d7740cbbc7e79d2c52b4ab70f14c72e1e77e01789e4932c
|
||||
ssa_ast: a4166d418cadd9c9994b6d882f94cabbc80d302439c3e738c19d8603e3e56af4
|
||||
flattened_ast: 57adb6faa6d37efd88f5a2e5cdbded5f791c5a18bd5487a2a286f127c26ef960
|
||||
inlined_ast: 57adb6faa6d37efd88f5a2e5cdbded5f791c5a18bd5487a2a286f127c26ef960
|
||||
flattened_ast: bf07e16742127065efb1989aef9582c08c8a6251057c5ae8e422901aaf46a3fa
|
||||
inlined_ast: bf07e16742127065efb1989aef9582c08c8a6251057c5ae8e422901aaf46a3fa
|
||||
bytecode: 27556a268723e0d8ffc4210290babab1ad098d9c8a77ad2dc84195d98059deac
|
||||
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- initial_ast: 42426e586a4fe69f06466e4621a8cf4547408ad38c108a85bf0beaf812859a66
|
||||
unrolled_ast: 42426e586a4fe69f06466e4621a8cf4547408ad38c108a85bf0beaf812859a66
|
||||
ssa_ast: 4b33649beef6673aafce25c35c16c034fb41ec33fdf562751b7e51d712caf309
|
||||
flattened_ast: e2ee2ee7c6e1c187de5977f44b0a39e11d946243990eb48df92b3a3e939b3906
|
||||
inlined_ast: aae0684cc29719b75d1af553fae21f9cafd04d15fd211eeb4d8cebbf913bcd6c
|
||||
bytecode: da94a3a78e8ddb3883dafdc52da31472986f7e4a89348e03acaa1f7d1de5bb31
|
@ -5,6 +5,6 @@ outputs:
|
||||
- initial_ast: bde5dc5690f0be194a47c5bf9f39c11fc4ce1e2fa04d15970cdb60ead041395b
|
||||
unrolled_ast: bde5dc5690f0be194a47c5bf9f39c11fc4ce1e2fa04d15970cdb60ead041395b
|
||||
ssa_ast: 4a1a21498e62feefd9db31a254c1015703dc89dec4a32c39f1ab851279fb2ddc
|
||||
flattened_ast: e0a1a88896578a09a0b3c83861ee9594916fac44b62290c052be08a97258bbc6
|
||||
inlined_ast: e0a1a88896578a09a0b3c83861ee9594916fac44b62290c052be08a97258bbc6
|
||||
flattened_ast: cfbbdf28d0919efc98023b650c0fa88cd90b0b17ba62fe7b7f12b20cad4c8bab
|
||||
inlined_ast: cfbbdf28d0919efc98023b650c0fa88cd90b0b17ba62fe7b7f12b20cad4c8bab
|
||||
bytecode: f5572172f6812e0eb6e906c230138c76d1344fd15522b8b2ee98156d6c92ca0a
|
||||
|
@ -0,0 +1,29 @@
|
||||
---
|
||||
namespace: Execute
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- initial_ast: 4f771e398a6a7dd30e05b1a2733a4c3d41654e3f5a116a02ed7a862bd3267a06
|
||||
unrolled_ast: 4f771e398a6a7dd30e05b1a2733a4c3d41654e3f5a116a02ed7a862bd3267a06
|
||||
ssa_ast: 82daba4fefc51c3e851850edd804ac76ced396d25f82c68e808d3953028fa780
|
||||
flattened_ast: 14521ee56079b67838d1dd0d9b26e464fc6bfd5e6cc649621c0210a8b2b34ed2
|
||||
inlined_ast: 0fd1095d0790c80c3114d8e45b6409f1810eb5b6e05224dbc5843092150e6520
|
||||
bytecode: 1887edbf4dd13f3913bebb36b012a4513cb26d8a8570d99bd0ac542f4bdb1c73
|
||||
results:
|
||||
bar:
|
||||
- input: "[true, true, 1u8, 0u8]"
|
||||
output: "[1u8, 1u8, {\n a: 1u8,\n b: 0u8,\n c: {\n c: 1u8\n }\n}]"
|
||||
- input: "[true, false, 1u8, 1u8]"
|
||||
output: "[1u8, 1u8, {\n a: 1u8,\n b: 1u8,\n c: {\n c: 1u8\n }\n}]"
|
||||
- input: "[false, true, 2u8, 1u8]"
|
||||
output: "[3u8, 1u8, {\n a: 2u8,\n b: 1u8,\n c: {\n c: 2u8\n }\n}]"
|
||||
- input: "[false, false, 2u8, 2u8]"
|
||||
output: "[2u8, 2u8, {\n a: 2u8,\n b: 2u8,\n c: {\n c: 2u8\n }\n}]"
|
||||
blar:
|
||||
- input: "[true, true, 1u8, 0u8]"
|
||||
output: "[1u8, 1u8, {\n a: 1u8,\n b: 1u8,\n c: {\n c: 1u8\n }\n}]"
|
||||
- input: "[true, false, 1u8, 1u8]"
|
||||
output: "[1u8, 1u8, {\n a: 1u8,\n b: 1u8,\n c: {\n c: 1u8\n }\n}]"
|
||||
- input: "[false, true, 2u8, 1u8]"
|
||||
output: "[1u8, 1u8, {\n a: 1u8,\n b: 1u8,\n c: {\n c: 1u8\n }\n}]"
|
||||
- input: "[false, false, 2u8, 2u8]"
|
||||
output: "[2u8, 2u8, {\n a: 2u8,\n b: 2u8,\n c: {\n c: 2u8\n }\n}]"
|
@ -2,4 +2,4 @@
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition' -- found '1'\n --> test:4:5\n |\n 4 | 1 main() {}}\n | ^"
|
||||
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found '1'\n --> test:4:5\n |\n 4 | 1 main() {}}\n | ^"
|
||||
|
67
tests/expectations/parser/functions/inline_function.out
Normal file
67
tests/expectations/parser/functions/inline_function.out
Normal file
@ -0,0 +1,67 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- imports: {}
|
||||
program_scopes:
|
||||
"{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}":
|
||||
program_id: "{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}"
|
||||
structs: {}
|
||||
mappings: {}
|
||||
functions:
|
||||
foo:
|
||||
annotations: []
|
||||
variant: Inline
|
||||
identifier: "{\"name\":\"foo\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":36}\"}"
|
||||
input:
|
||||
- Internal:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}"
|
||||
mode: None
|
||||
type_:
|
||||
Integer: U32
|
||||
span:
|
||||
lo: 37
|
||||
hi: 38
|
||||
- Internal:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":45,\\\"hi\\\":46}\"}"
|
||||
mode: None
|
||||
type_:
|
||||
Integer: I32
|
||||
span:
|
||||
lo: 45
|
||||
hi: 46
|
||||
output:
|
||||
- Internal:
|
||||
mode: None
|
||||
type_:
|
||||
Integer: U32
|
||||
span:
|
||||
lo: 56
|
||||
hi: 59
|
||||
output_type:
|
||||
Integer: U32
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
Literal:
|
||||
Integer:
|
||||
- U32
|
||||
- "0"
|
||||
- span:
|
||||
lo: 77
|
||||
hi: 81
|
||||
finalize_arguments: ~
|
||||
span:
|
||||
lo: 70
|
||||
hi: 82
|
||||
span:
|
||||
lo: 60
|
||||
hi: 88
|
||||
finalize: ~
|
||||
span:
|
||||
lo: 26
|
||||
hi: 88
|
||||
span:
|
||||
lo: 2
|
||||
hi: 90
|
@ -2,4 +2,4 @@
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition' -- found 'test'\n --> test:4:5\n |\n 4 | test main() {}}\n | ^^^^"
|
||||
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found 'test'\n --> test:4:5\n |\n 4 | test main() {}}\n | ^^^^"
|
||||
|
67
tests/expectations/parser/functions/transition_function.out
Normal file
67
tests/expectations/parser/functions/transition_function.out
Normal file
@ -0,0 +1,67 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- imports: {}
|
||||
program_scopes:
|
||||
"{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}":
|
||||
program_id: "{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}"
|
||||
structs: {}
|
||||
mappings: {}
|
||||
functions:
|
||||
foo:
|
||||
annotations: []
|
||||
variant: Transition
|
||||
identifier: "{\"name\":\"foo\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":40}\"}"
|
||||
input:
|
||||
- Internal:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":41,\\\"hi\\\":42}\"}"
|
||||
mode: None
|
||||
type_:
|
||||
Integer: U32
|
||||
span:
|
||||
lo: 41
|
||||
hi: 42
|
||||
- Internal:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":49,\\\"hi\\\":50}\"}"
|
||||
mode: None
|
||||
type_:
|
||||
Integer: I32
|
||||
span:
|
||||
lo: 49
|
||||
hi: 50
|
||||
output:
|
||||
- Internal:
|
||||
mode: None
|
||||
type_:
|
||||
Integer: U32
|
||||
span:
|
||||
lo: 60
|
||||
hi: 63
|
||||
output_type:
|
||||
Integer: U32
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
Literal:
|
||||
Integer:
|
||||
- U32
|
||||
- "0"
|
||||
- span:
|
||||
lo: 81
|
||||
hi: 85
|
||||
finalize_arguments: ~
|
||||
span:
|
||||
lo: 74
|
||||
hi: 86
|
||||
span:
|
||||
lo: 64
|
||||
hi: 92
|
||||
finalize: ~
|
||||
span:
|
||||
lo: 26
|
||||
hi: 92
|
||||
span:
|
||||
lo: 2
|
||||
hi: 94
|
@ -2,4 +2,4 @@
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition' -- found 'mappin'\n --> test:4:5\n |\n 4 | mappin balances: address => u128;\n | ^^^^^^"
|
||||
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found 'mappin'\n --> test:4:5\n |\n 4 | mappin balances: address => u128;\n | ^^^^^^"
|
||||
|
Loading…
Reference in New Issue
Block a user