mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-24 07:48:04 +03:00
add inline circuit integration tests
This commit is contained in:
parent
cd5811dfd6
commit
f5be2e037f
8
compiler/tests/circuits/inline_member_fail.leo
Normal file
8
compiler/tests/circuits/inline_member_fail.leo
Normal file
@ -0,0 +1,8 @@
|
||||
circuit Foo {
|
||||
x: u8
|
||||
}
|
||||
|
||||
function main() {
|
||||
let y: u8 = 1;
|
||||
let a = Foo { y };
|
||||
}
|
13
compiler/tests/circuits/inline_member_pass.leo
Normal file
13
compiler/tests/circuits/inline_member_pass.leo
Normal file
@ -0,0 +1,13 @@
|
||||
circuit Foo {
|
||||
x: u8
|
||||
|
||||
function new(x: u8) -> Self {
|
||||
return Self { x }
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
let x: u8 = 1;
|
||||
let a = Foo { x };
|
||||
let b = Foo::new(x);
|
||||
}
|
@ -248,6 +248,24 @@ fn test_self_member_undefined() {
|
||||
expect_asg_error(error);
|
||||
}
|
||||
|
||||
// Inline circuit member
|
||||
|
||||
#[test]
|
||||
fn test_inline_member_pass() {
|
||||
let program_string = include_str!("inline_member_pass.leo");
|
||||
let program = parse_program(program_string).unwrap();
|
||||
|
||||
assert_satisfied(program);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_inline_member_fail() {
|
||||
let program_string = include_str!("inline_member_fail.leo");
|
||||
let error = parse_program(program_string).err().unwrap();
|
||||
|
||||
expect_asg_error(error);
|
||||
}
|
||||
|
||||
// All
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user