mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 02:31:44 +03:00
refactor more iteration tests
This commit is contained in:
parent
f0a6e9421b
commit
5777c76d04
@ -101,7 +101,7 @@ impl ParserContext<'_> {
|
||||
|
||||
// Throw an error if the import file doesn't exist.
|
||||
if !import_file_path.exists() {
|
||||
return Err(CompilerError::import_not_found(import_file_path.display(), self.token.span).into());
|
||||
return Err(CompilerError::import_not_found(import_file_path.display(), self.prev_token.span).into());
|
||||
}
|
||||
|
||||
// Read the import file into string.
|
||||
|
@ -1,5 +1,2 @@
|
||||
[main]
|
||||
a: i8 = 1i8;
|
||||
|
||||
[registers]
|
||||
r0: bool = true;
|
||||
a: i8 = 1i8;
|
@ -1,6 +1,3 @@
|
||||
[main]
|
||||
x: u8 = 3u8;
|
||||
y: bool = true;
|
||||
|
||||
[registers]
|
||||
a: u8 = 0u8;
|
||||
y: bool = true;
|
@ -1,5 +1,2 @@
|
||||
[main]
|
||||
x: u32 = 3u32;
|
||||
|
||||
[registers]
|
||||
a: bool = false;
|
@ -1,5 +1,2 @@
|
||||
[main]
|
||||
x: u32 = 5u32;
|
||||
|
||||
[registers]
|
||||
a: bool = false;
|
||||
x: u32 = 5u32;
|
@ -1,5 +1,2 @@
|
||||
[main]
|
||||
x: u32 = 6u32;
|
||||
|
||||
[registers]
|
||||
a: bool = false;
|
||||
x: u32 = 6u32;
|
17
tests/compiler/statements/iteration_nested.leo
Normal file
17
tests/compiler/statements/iteration_nested.leo
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: inputs/u32_3.in
|
||||
*/
|
||||
|
||||
function main(x: u32) -> u32 {
|
||||
let y: u32 = x;
|
||||
|
||||
for i: u32 in 0u32..2u32 {
|
||||
for j: u32 in 0u32..2u32 {
|
||||
y = y + 1u32;
|
||||
}
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
@ -3,7 +3,7 @@ namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: d50bb92b3d32c220f9b177a2944e83524ec638210e3c3e9ef250c3f8a83b5763
|
||||
- initial_input_ast: 3e1c7ad7391827e106457839413bf85010988ea959e65aa886551b0c6917b25e
|
||||
initial_ast: cbffad01dfba4f4a7edc9d3dd648dcc579b3c35643b94a39136e1461cd22cc73
|
||||
unrolled_ast: cbffad01dfba4f4a7edc9d3dd648dcc579b3c35643b94a39136e1461cd22cc73
|
||||
ssa_ast: ee2532244bd5d690146aa195724462fce2f1fca9f47cd8b90465330e7297b468
|
||||
|
@ -3,9 +3,9 @@ namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: aa02d314388c981213199b82875cbcd5d9294f4a2437f1ad43cad3d932477cfc
|
||||
- initial_input_ast: c6b87710f157f556462a1863022511355541148837c2fbe22ae3a24f701f9009
|
||||
- initial_input_ast: 671bfce5bcae583d2f2887463fc7b8e6ba382342e4487deffb21f788854fcce0
|
||||
- initial_input_ast: 099858521f685395ad30dc798ca7edc52a2d681044e86766d3df5fbc5284f6a0
|
||||
- initial_input_ast: a35737f164b8311e127ba8a4d6313c1195b66de26e2800ad95397d795ae006b0
|
||||
- initial_input_ast: d264a0cababb36d4cc7304beff80ed0a42fe626b9002adacbe594af847a1f47d
|
||||
initial_ast: 2e9922d1559751ce17eb9484f297ad8196d3516c7904bf3a167d5f9810533f30
|
||||
unrolled_ast: 2e9922d1559751ce17eb9484f297ad8196d3516c7904bf3a167d5f9810533f30
|
||||
ssa_ast: 2b1904cf6e5e88ab7573141c2e31e8b9998d4024f6a0ebe3229aec61c67e3cfb
|
||||
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: 2536e33f2d79d2aef1e1dcc6d2c731605f22086a5d1c7f4a364383fb15b89b97
|
||||
initial_ast: 1103461b81a0a8e24c65d27a0f569715946dbb424dd1c6b5a2c41beb4bb96230
|
||||
unrolled_ast: 2a9e2923379ca24b043afe465cdae88dd5ef28f255149f57cd5302042ea629a2
|
||||
ssa_ast: b1e4fe312f740181b4a7155f3d482119364d00dc103daface4e131211fc0cae5
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: e8caaaa48fd4ca19b2d31da65831711c477323db6fb477cbe2e1abcd9182e0e9
|
||||
initial_ast: b540a2430fa67d651a52d46ca96aa981c9ae7670a2524f9bc830435a5117b171
|
||||
unrolled_ast: d024c73e29934c57ddd22dafcde4100e773491e462b190fdd943fc64ec709d1d
|
||||
ssa_ast: 7db305c51ad2b3c03f1d69dca9c2bbc16bccff7e011dc23fa8bd7a1b0613a22d
|
@ -3,8 +3,8 @@ namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: d50bb92b3d32c220f9b177a2944e83524ec638210e3c3e9ef250c3f8a83b5763
|
||||
- initial_input_ast: 86bde1be3731f0556c98e727518d64912becc5ec59fc5324caad88ec2af9466b
|
||||
- initial_input_ast: 3e1c7ad7391827e106457839413bf85010988ea959e65aa886551b0c6917b25e
|
||||
- initial_input_ast: 05aec88bcd0cad7448814728a983f3ff8cb52f9dc5f9bd464e130f18c4ae1033
|
||||
initial_ast: 72f2d64a55e6db776ee3af263fe200d8dd806e4f20e27696012e49f6987a8609
|
||||
unrolled_ast: 72f2d64a55e6db776ee3af263fe200d8dd806e4f20e27696012e49f6987a8609
|
||||
ssa_ast: 567f9e9a2688896cad548bec48b0d91b6418d7a1857f1b33ea8dfdafecfabb4b
|
||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: 9e2c58fdce9ddc6c6fb38937bc719ac2cd48b67f4494c3432b6fbab07a2bcd8b
|
||||
- initial_input_ast: 2fd36e0c315d84653246f0d015f62b979c097510176d95961bb06e1b2f6530c8
|
||||
- initial_input_ast: 39f57bd6523db083837653e04356cc4b201e93e887dc11d89a1a51029e92236a
|
||||
- initial_input_ast: 965f2de6d6d4b0d3b2bf32e29ca196835aec7ca5803f9c6a33b8987185a5c233
|
||||
initial_ast: 97eb6d68a9c10827d6420dc9013f0c391291bfb52df42439f9fb9fa30abb6a93
|
||||
unrolled_ast: 97eb6d68a9c10827d6420dc9013f0c391291bfb52df42439f9fb9fa30abb6a93
|
||||
ssa_ast: b7e0a3b368e4566a568fd1cc79b9d071ea529980f8464dbc707adf2e80b92045
|
||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: 08cf0b82d701b0529b62919009d3c46f129ac45ce385efba85986ccf3029f70b
|
||||
- initial_input_ast: fb744c11bbf167bd99bd67ad37031466e9292e06da1c2ea21142c3a03f7c3790
|
||||
initial_ast: 9cb9c5e2c30cdac7dc27c26425dbb854ef9d33624c9097d531f3cd64caf4fe9c
|
||||
unrolled_ast: 9cb9c5e2c30cdac7dc27c26425dbb854ef9d33624c9097d531f3cd64caf4fe9c
|
||||
ssa_ast: c8787619b460330a7e09876da27593d2aa5ddfff595043416530dd75a505c512
|
||||
|
11
tests/parser/statement/import_circuit.leo
Normal file
11
tests/parser/statement/import_circuit.leo
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: inputs/u32_3.in
|
||||
cwd: statement
|
||||
*/
|
||||
import foo.leo;
|
||||
|
||||
function main(a: u32) -> Foo {
|
||||
return Foo { a: a };
|
||||
}
|
@ -14,7 +14,7 @@ function iteration() -> u32 {
|
||||
return a;
|
||||
}
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
function main(k: bool) -> bool {
|
||||
const total: u32 = iteration() + iteration();
|
||||
|
||||
return (total == 20u32) == y;
|
||||
|
Loading…
Reference in New Issue
Block a user