633: duplicate name context test r=collinc97 a=gluax

Adding a test for duplicate name context that was resolved in #546.

634: fn call array params r=collinc97 a=gluax

Adding a test for bug #522, which was resolved by the asg.

Closes #522 

Co-authored-by: gluaxspeed <jonathan.t.pavlik@gmail.com>
This commit is contained in:
bors[bot] 2021-02-11 07:53:26 +00:00 committed by GitHub
commit a3f0f9d587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,13 @@
circuit Bar {
b2: u32
function add_five(z:u32) -> u32 {
return z+5u32
}
}
function main () {
let Bar = 66u32;
const k1 = Bar{ b2: 30u32 };
const k2 = Bar::add_five(55u32);
}

View File

@ -283,3 +283,11 @@ fn test_define_circuit_inside_circuit_function() {
assert_satisfied(program);
}
#[test]
fn test_duplicate_name_context() {
let program_string = include_str!("duplicate_name_context.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}

View File

@ -0,0 +1,9 @@
function do_nothing(arr: [u32; 2]) {}
function main() {
let arr: [u32; 2] = [0; 2];
do_nothing(arr);
do_nothing([...arr]);
do_nothing(arr[1u32..]);
}

View File

@ -203,3 +203,11 @@ fn test_return_tuple_conditional() {
assert_satisfied(program);
}
#[test]
fn test_array_params_direct_call() {
let program_string = include_str!("array_params_direct_call.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}