add tests for large array initializer

This commit is contained in:
collin 2020-09-02 16:49:06 -07:00
parent bd3b465a4f
commit 84a874b0ce
3 changed files with 27 additions and 1 deletions

View File

@ -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);
}

View 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);
}

View File

@ -0,0 +1,3 @@
function main() {
let arr: [u8; (2, 2)] = [1u8; (2, 1)]; // incorrect dimensions
}