mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 10:41:57 +03:00
Add tests for expr statements
This commit is contained in:
parent
af8b63d12a
commit
cf9948e99c
16
tests/compiler/statements/expr_statement.leo
Normal file
16
tests/compiler/statements/expr_statement.leo
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
|
||||
function foo(a: u8, b: u8) -> () {
|
||||
console.assert_eq(a, b);
|
||||
}
|
||||
|
||||
transition main(a: u8, b: u8) -> u8 {
|
||||
foo(a, b);
|
||||
return a + b;
|
||||
}
|
||||
}
|
26
tests/compiler/statements/expr_statement_fail.leo
Normal file
26
tests/compiler/statements/expr_statement_fail.leo
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
|
||||
struct Foo {
|
||||
a: u8,
|
||||
}
|
||||
|
||||
transition foo(flag: bool, a: u8, b: u8, foo: Foo, i: i8) -> u8 {
|
||||
a + b;
|
||||
flag ? a : b;
|
||||
foo.a;
|
||||
Foo {
|
||||
a: a,
|
||||
};
|
||||
a;
|
||||
1u8;
|
||||
-i8;
|
||||
();
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user