leo/tests/compiler/array/complex_access.leo

35 lines
709 B
Plaintext

/*
namespace: Compile
expectation: Pass
input_file:
- input/complex_access.in
*/
circuit Circ {
f: u32
}
function main (a: [u8; 8], b: u32, c: [[u8; 3]; 3], d: [(u8, u32); 1], e: [u8; (3, 4)] ) -> bool {
a[0..3][b] = 93;
a[2..6][1] = 87;
a[2..6][1] *= 2;
a[2..3] = [42u8];
a[6..][0] = 43u8;
a[0..1][0..1] = [200];
c[0..2][0] = [1u8; 3];
c[1..][1][1..2][0] = 126;
c[1..][0] = [42, 43, 44];
c[Circ {f: 0}.f..1][0][0] += 2;
d[..1][0].1 = 1;
e[0..][0] = [22; 4];
e[0..][0][0] = 33;
return
a == [200u8, 93, 42, 174, 5, 6, 43, 8]
&& c == [[3u8, 1, 1], [42, 43, 44], [7, 126, 9]]
&& d == [(0u8, 1u32)]
&& e == [[33u8, 22, 22, 22], [0, 0, 0, 0], [0, 0, 0, 0]];
}