Skip to content

Commit

Permalink
add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
guipublic committed May 4, 2023
1 parent 6c8fe86 commit c553618
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/nargo_cli/tests/test_data/array_dynamic/Prover.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
x = [104, 101, 108, 108, 111]
z = "59"
t = "10"
index = [0,1,2,3,4]


10 changes: 9 additions & 1 deletion crates/nargo_cli/tests/test_data/array_dynamic/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@

fn main(x: [u32; 5], mut z: u32, t: u32) {
fn main(x: [u32; 5], mut z: u32, t: u32, index: [Field;5]) {
let idx = (z - 5*t - 5) as Field;
//dynamic array test
dyn_array(x, idx, idx - 3);

// regression for issue 1283
let mut s = 0;
let x3 = [246,159,32,176,8];
for i in 0..5 {
s += x3[index[i]];
}
assert(s!=0);
}

fn dyn_array(mut x: [u32; 5], y: Field, z: Field) {
Expand Down

0 comments on commit c553618

Please sign in to comment.