mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-27 03:21:49 +03:00
merge from pr 638
This commit is contained in:
commit
42fb5ea635
@ -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 {
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
[main]
|
||||||
|
x: [i16; (2, 2, 3)] = [0i16; (2, 2, 3)];
|
@ -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);
|
||||||
|
}
|
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user