mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-28 01:01:53 +03:00
add tests for large array initializer
This commit is contained in:
parent
bd3b465a4f
commit
84a874b0ce
@ -147,7 +147,7 @@ fn test_multi() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_initializer_fail() {
|
||||
fn test_multi_fail() {
|
||||
let program_bytes = include_bytes!("multi_fail_initializer.leo");
|
||||
let program = parse_program(program_bytes).unwrap();
|
||||
|
||||
@ -161,3 +161,19 @@ fn test_multi_inline_fail() {
|
||||
|
||||
expect_compiler_error(program);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_initializer() {
|
||||
let program_bytes = include_bytes!("multi_initializer.leo");
|
||||
let program = parse_program(program_bytes).unwrap();
|
||||
|
||||
assert_satisfied(program);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_initializer_fail() {
|
||||
let program_bytes = include_bytes!("multi_initializer_fail.leo");
|
||||
let program = parse_program(program_bytes).unwrap();
|
||||
|
||||
expect_compiler_error(program);
|
||||
}
|
||||
|
7
compiler/tests/array/multi_initializer.leo
Normal file
7
compiler/tests/array/multi_initializer.leo
Normal file
@ -0,0 +1,7 @@
|
||||
function main() {
|
||||
const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)];
|
||||
|
||||
const b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2];
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
3
compiler/tests/array/multi_initializer_fail.leo
Normal file
3
compiler/tests/array/multi_initializer_fail.leo
Normal file
@ -0,0 +1,3 @@
|
||||
function main() {
|
||||
let arr: [u8; (2, 2)] = [1u8; (2, 1)]; // incorrect dimensions
|
||||
}
|
Loading…
Reference in New Issue
Block a user