From c553618bfb0791e0b02ae62299580c6afebe45db Mon Sep 17 00:00:00 2001 From: guipublic Date: Thu, 4 May 2023 15:41:22 +0000 Subject: [PATCH] add regression test --- .../tests/test_data/array_dynamic/Prover.toml | 1 + .../tests/test_data/array_dynamic/src/main.nr | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/nargo_cli/tests/test_data/array_dynamic/Prover.toml b/crates/nargo_cli/tests/test_data/array_dynamic/Prover.toml index 1e652e28d1c..ff6f02ccdac 100644 --- a/crates/nargo_cli/tests/test_data/array_dynamic/Prover.toml +++ b/crates/nargo_cli/tests/test_data/array_dynamic/Prover.toml @@ -1,5 +1,6 @@ x = [104, 101, 108, 108, 111] z = "59" t = "10" +index = [0,1,2,3,4] diff --git a/crates/nargo_cli/tests/test_data/array_dynamic/src/main.nr b/crates/nargo_cli/tests/test_data/array_dynamic/src/main.nr index 73dc162eb1b..942ac14f38c 100644 --- a/crates/nargo_cli/tests/test_data/array_dynamic/src/main.nr +++ b/crates/nargo_cli/tests/test_data/array_dynamic/src/main.nr @@ -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) {