mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-28 01:01:53 +03:00
add tests for invalid integers in array size
This commit is contained in:
parent
febdf51ca5
commit
1f1a49a5d3
3
compiler/tests/array/initializer_fail.leo
Normal file
3
compiler/tests/array/initializer_fail.leo
Normal file
@ -0,0 +1,3 @@
|
||||
function main(a: u8[3]) {
|
||||
assert_eq!(a, [1u8; -3]);
|
||||
}
|
@ -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");
|
||||
|
3
compiler/tests/array/type_fail.leo
Normal file
3
compiler/tests/array/type_fail.leo
Normal file
@ -0,0 +1,3 @@
|
||||
let main() {
|
||||
let a: u32[-2] = [0u32; 2];
|
||||
}
|
Loading…
Reference in New Issue
Block a user