leo/compiler/tests/mutability/mod.rs

91 lines
2.0 KiB
Rust
Raw Normal View History

2020-07-31 02:37:01 +03:00
use crate::{assert_satisfied, expect_compiler_error, generate_main_inputs, parse_program};
use leo_types::InputValue;
#[test]
fn test_let() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("let.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
expect_compiler_error(program);
}
#[test]
fn test_let_mut() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("let_mut.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
assert_satisfied(program);
}
2020-06-30 06:29:53 +03:00
#[test]
fn test_const_fail() {
let bytes = include_bytes!("const.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
expect_compiler_error(program);
2020-06-30 06:29:53 +03:00
}
#[test]
fn test_const_mut_fail() {
let bytes = include_bytes!("const_mut.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
expect_compiler_error(program);
2020-06-30 06:29:53 +03:00
}
#[test]
fn test_array() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("array.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
expect_compiler_error(program);
}
#[test]
fn test_array_mut() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("array_mut.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
assert_satisfied(program);
}
#[test]
fn test_circuit() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("circuit.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
expect_compiler_error(program);
}
#[test]
fn test_circuit_mut() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("circuit_mut.leo");
let program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
assert_satisfied(program);
}
#[test]
fn test_function_input() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("function_input.leo");
let mut program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
let main_inputs = generate_main_inputs(vec![("a", Some(InputValue::Boolean(true)))]);
program.set_main_inputs(main_inputs);
expect_compiler_error(program);
}
#[test]
fn test_function_input_mut() {
2020-06-09 04:55:44 +03:00
let bytes = include_bytes!("function_input_mut.leo");
let mut program = parse_program(bytes).unwrap();
2020-07-31 02:37:01 +03:00
let main_inputs = generate_main_inputs(vec![("a", Some(InputValue::Boolean(true)))]);
program.set_main_inputs(main_inputs);
assert_satisfied(program);
}