merge from pr 638

This commit is contained in:
gluaxspeed 2021-02-10 11:59:42 -05:00
commit 42fb5ea635
4 changed files with 19 additions and 1 deletions

View File

@ -177,7 +177,7 @@ impl InputValue {
let mut elements = vec![]; let mut elements = vec![];
// Build the elements of the array using the `vec!` macro // Build the elements of the array using the `vec!` macro
for (i, dimension) in initializer_dimensions.into_iter().enumerate() { for (i, dimension) in initializer_dimensions.into_iter().rev().enumerate() {
if i == 0 { if i == 0 {
elements = vec![value.clone(); dimension]; elements = vec![value.clone(); dimension];
} else { } else {

View File

@ -0,0 +1,2 @@
[main]
x: [i16; (2, 2, 3)] = [0i16; (2, 2, 3)];

View File

@ -0,0 +1,6 @@
function main(x: [i16; (2, 2, 3)]){
console.log("x: {}", x);
let y: [i16; (2, 2, 3)] = [0i16; (2, 2, 3)];
console.log("y: {}", y);
}

View File

@ -44,6 +44,16 @@ fn test_input_array_fail() {
assert_satisfied(program); assert_satisfied(program);
} }
#[test]
fn test_input_multi_dimension_array() {
let program_string = include_str!("main_multi_dimension_array.leo");
let input_string = include_str!("input/main_multi_dimension_array.in");
let program = parse_program_with_input(program_string, input_string).unwrap();
assert_satisfied(program);
}
#[test] #[test]
fn test_input_fail_name() { fn test_input_fail_name() {
let program_string = include_str!("main.leo"); let program_string = include_str!("main.leo");