add tests for invalid integers in array size

This commit is contained in:
collin 2020-08-03 14:56:45 -07:00
parent febdf51ca5
commit 1f1a49a5d3
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,3 @@
function main(a: u8[3]) {
assert_eq!(a, [1u8; -3]);
}

View File

@ -42,6 +42,14 @@ fn test_registers() {
// Expressions
#[test]
fn test_type_fail() {
let program_bytes = include_bytes!("type_fail.leo");
let syntax_error = parse_program(program_bytes).is_err();
assert!(syntax_error);
}
#[test]
fn test_inline() {
let program_bytes = include_bytes!("inline.leo");
@ -68,6 +76,15 @@ fn test_initializer() {
assert_satisfied(program);
}
#[test]
fn test_initializer_fail() {
let program_bytes = include_bytes!("initializer_fail.leo");
let input_bytes = include_bytes!("input/three_ones.in");
let syntax_error = parse_program_with_input(program_bytes, input_bytes).is_err();
assert!(syntax_error);
}
#[test]
fn test_spread() {
let program_bytes = include_bytes!("spread.leo");

View File

@ -0,0 +1,3 @@
let main() {
let a: u32[-2] = [0u32; 2];
}