mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-25 19:22:01 +03:00
use include_str in all program tests
This commit is contained in:
parent
7976c739e9
commit
674caf5902
@ -22,72 +22,72 @@ static TEST_ADDRESS_2: &str = "aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_valid() {
|
fn test_valid() {
|
||||||
let bytes = include_bytes!("valid.leo");
|
let program_string = include_str!("valid.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program)
|
assert_satisfied(program)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invalid_prefix() {
|
fn test_invalid_prefix() {
|
||||||
let bytes = include_bytes!("invalid_prefix.leo");
|
let program_string = include_str!("invalid_prefix.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(program_string).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invalid_length() {
|
fn test_invalid_length() {
|
||||||
let bytes = include_bytes!("invalid_length.leo");
|
let program_string = include_str!("invalid_length.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(program_string).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_empty() {
|
fn test_empty() {
|
||||||
let bytes = include_bytes!("empty.leo");
|
let program_string = include_str!("empty.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(program_string).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_implicit_valid() {
|
fn test_implicit_valid() {
|
||||||
let bytes = include_bytes!("implicit_valid.leo");
|
let program_string = include_str!("implicit_valid.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_implicit_invalid() {
|
fn test_implicit_invalid() {
|
||||||
let bytes = include_bytes!("implicit_invalid.leo");
|
let program_string = include_str!("implicit_invalid.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _output = expect_compiler_error(program);
|
let _output = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_console_assert_pass() {
|
fn test_console_assert_pass() {
|
||||||
let bytes = include_bytes!("console_assert_pass.leo");
|
let program_string = include_str!("console_assert_pass.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_console_assert_fail() {
|
fn test_console_assert_fail() {
|
||||||
let bytes = include_bytes!("console_assert_fail.leo");
|
let program_string = include_str!("console_assert_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _output = expect_compiler_error(program);
|
let _output = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ternary() {
|
fn test_ternary() {
|
||||||
let bytes = include_bytes!("ternary.leo");
|
let program_string = include_str!("ternary.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
("s", Some(InputValue::Boolean(true))),
|
("s", Some(InputValue::Boolean(true))),
|
||||||
@ -98,7 +98,7 @@ fn test_ternary() {
|
|||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
|
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
("s", Some(InputValue::Boolean(false))),
|
("s", Some(InputValue::Boolean(false))),
|
||||||
@ -112,8 +112,8 @@ fn test_ternary() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_equal() {
|
fn test_equal() {
|
||||||
let bytes = include_bytes!("equal.leo");
|
let program_string = include_str!("equal.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
|
("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
|
||||||
@ -125,7 +125,7 @@ fn test_equal() {
|
|||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
|
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
|
("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
|
||||||
|
@ -69,8 +69,8 @@ fn test_inline() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_inline_fail() {
|
fn test_inline_fail() {
|
||||||
let program_bytes = include_bytes!("inline.leo");
|
let program_string = include_str!("inline.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
@ -149,64 +149,64 @@ fn test_input_tuple_3x2_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multi_fail_initializer() {
|
fn test_multi_fail_initializer() {
|
||||||
let program_bytes = include_bytes!("multi_fail_initializer.leo");
|
let program_string = include_str!("multi_fail_initializer.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multi_inline_fail() {
|
fn test_multi_inline_fail() {
|
||||||
let program_bytes = include_bytes!("multi_fail_inline.leo");
|
let program_string = include_str!("multi_fail_inline.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multi_initializer() {
|
fn test_multi_initializer() {
|
||||||
let program_bytes = include_bytes!("multi_initializer.leo");
|
let program_string = include_str!("multi_initializer.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multi_initializer_fail() {
|
fn test_multi_initializer_fail() {
|
||||||
let program_bytes = include_bytes!("multi_initializer_fail.leo");
|
let program_string = include_str!("multi_initializer_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nested_3x2_value() {
|
fn test_nested_3x2_value() {
|
||||||
let program_bytes = include_bytes!("nested_3x2_value.leo");
|
let program_string = include_str!("nested_3x2_value.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nested_3x2_value_fail() {
|
fn test_nested_3x2_value_fail() {
|
||||||
let program_bytes = include_bytes!("nested_3x2_value_fail.leo");
|
let program_string = include_str!("nested_3x2_value_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tuple_3x2_value() {
|
fn test_tuple_3x2_value() {
|
||||||
let program_bytes = include_bytes!("tuple_3x2_value.leo");
|
let program_string = include_str!("tuple_3x2_value.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tuple_3x2_value_fail() {
|
fn test_tuple_3x2_value_fail() {
|
||||||
let program_bytes = include_bytes!("tuple_3x2_value_fail.leo");
|
let program_string = include_str!("tuple_3x2_value_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
@ -233,136 +233,136 @@ fn test_slice() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_fail() {
|
fn test_type_fail() {
|
||||||
let program_bytes = include_bytes!("type_fail.leo");
|
let program_string = include_str!("type_fail.leo");
|
||||||
let syntax_error = parse_program(program_bytes).is_err();
|
let syntax_error = parse_program(program_string).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_nested_3x2() {
|
fn test_type_nested_value_nested_3x2() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_nested_3x2.leo");
|
let program_string = include_str!("type_nested_value_nested_3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_nested_3x2_fail() {
|
fn test_type_nested_value_nested_3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_nested_3x2_fail.leo");
|
let program_string = include_str!("type_nested_value_nested_3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_nested_4x3x2() {
|
fn test_type_nested_value_nested_4x3x2() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_nested_4x3x2.leo");
|
let program_string = include_str!("type_nested_value_nested_4x3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_nested_4x3x2_fail() {
|
fn test_type_nested_value_nested_4x3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_nested_4x3x2_fail.leo");
|
let program_string = include_str!("type_nested_value_nested_4x3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_tuple_3x2() {
|
fn test_type_nested_value_tuple_3x2() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_tuple_3x2.leo");
|
let program_string = include_str!("type_nested_value_tuple_3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_tuple_3x2_fail() {
|
fn test_type_nested_value_tuple_3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_tuple_3x2_fail.leo");
|
let program_string = include_str!("type_nested_value_tuple_3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_tuple_4x3x2() {
|
fn test_type_nested_value_tuple_4x3x2() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_tuple_4x3x2.leo");
|
let program_string = include_str!("type_nested_value_tuple_4x3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_nested_value_tuple_4x3x2_fail() {
|
fn test_type_nested_value_tuple_4x3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_nested_value_tuple_4x3x2_fail.leo");
|
let program_string = include_str!("type_nested_value_tuple_4x3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_nested_3x2() {
|
fn test_type_tuple_value_nested_3x2() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_nested_3x2.leo");
|
let program_string = include_str!("type_tuple_value_nested_3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_nested_3x2_fail() {
|
fn test_type_tuple_value_nested_3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_nested_3x2_fail.leo");
|
let program_string = include_str!("type_tuple_value_nested_3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_nested_4x3x2() {
|
fn test_type_tuple_value_nested_4x3x2() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_nested_4x3x2.leo");
|
let program_string = include_str!("type_tuple_value_nested_4x3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_nested_4x3x2_fail() {
|
fn test_type_tuple_value_nested_4x3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_nested_4x3x2_fail.leo");
|
let program_string = include_str!("type_tuple_value_nested_4x3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_tuple_3x2() {
|
fn test_type_tuple_value_tuple_3x2() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_tuple_3x2.leo");
|
let program_string = include_str!("type_tuple_value_tuple_3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_tuple_3x2_fail() {
|
fn test_type_tuple_value_tuple_3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_tuple_3x2_fail.leo");
|
let program_string = include_str!("type_tuple_value_tuple_3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_tuple_4x3x2() {
|
fn test_type_tuple_value_tuple_4x3x2() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_tuple_4x3x2.leo");
|
let program_string = include_str!("type_tuple_value_tuple_4x3x2.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_type_tuple_value_tuple_4x3x2_fail() {
|
fn test_type_tuple_value_tuple_4x3x2_fail() {
|
||||||
let program_bytes = include_bytes!("type_tuple_value_tuple_4x3x2_fail.leo");
|
let program_string = include_str!("type_tuple_value_tuple_4x3x2_fail.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_string).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ fn test_registers() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_not_true() {
|
fn test_not_true() {
|
||||||
let bytes = include_bytes!("not_true.leo");
|
let bytes = include_str!("not_true.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -87,7 +87,7 @@ fn test_not_true() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_not_false() {
|
fn test_not_false() {
|
||||||
let bytes = include_bytes!("not_false.leo");
|
let bytes = include_str!("not_false.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -95,7 +95,7 @@ fn test_not_false() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_not_mutable() {
|
fn test_not_mutable() {
|
||||||
let bytes = include_bytes!("not_mutable.leo");
|
let bytes = include_str!("not_mutable.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -103,7 +103,7 @@ fn test_not_mutable() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_not_u32() {
|
fn test_not_u32() {
|
||||||
let bytes = include_bytes!("not_u32.leo");
|
let bytes = include_str!("not_u32.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -113,7 +113,7 @@ fn test_not_u32() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_true_or_true() {
|
fn test_true_or_true() {
|
||||||
let bytes = include_bytes!("true_or_true.leo");
|
let bytes = include_str!("true_or_true.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -121,7 +121,7 @@ fn test_true_or_true() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_true_or_false() {
|
fn test_true_or_false() {
|
||||||
let bytes = include_bytes!("true_or_false.leo");
|
let bytes = include_str!("true_or_false.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -129,7 +129,7 @@ fn test_true_or_false() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_false_or_false() {
|
fn test_false_or_false() {
|
||||||
let bytes = include_bytes!("false_or_false.leo");
|
let bytes = include_str!("false_or_false.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -137,7 +137,7 @@ fn test_false_or_false() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_true_or_u32() {
|
fn test_true_or_u32() {
|
||||||
let bytes = include_bytes!("true_or_u32.leo");
|
let bytes = include_str!("true_or_u32.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -147,7 +147,7 @@ fn test_true_or_u32() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_true_and_true() {
|
fn test_true_and_true() {
|
||||||
let bytes = include_bytes!("true_and_true.leo");
|
let bytes = include_str!("true_and_true.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -155,7 +155,7 @@ fn test_true_and_true() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_true_and_false() {
|
fn test_true_and_false() {
|
||||||
let bytes = include_bytes!("true_and_false.leo");
|
let bytes = include_str!("true_and_false.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -163,7 +163,7 @@ fn test_true_and_false() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_false_and_false() {
|
fn test_false_and_false() {
|
||||||
let bytes = include_bytes!("false_and_false.leo");
|
let bytes = include_str!("false_and_false.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -171,7 +171,7 @@ fn test_false_and_false() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_true_and_u32() {
|
fn test_true_and_u32() {
|
||||||
let bytes = include_bytes!("true_and_u32.leo");
|
let bytes = include_str!("true_and_u32.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -181,7 +181,7 @@ fn test_true_and_u32() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_all() {
|
fn test_all() {
|
||||||
let bytes = include_bytes!("all.leo");
|
let bytes = include_str!("all.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
|
@ -20,7 +20,7 @@ use crate::{assert_satisfied, expect_compiler_error, expect_type_inference_error
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_inline() {
|
fn test_inline() {
|
||||||
let bytes = include_bytes!("inline.leo");
|
let bytes = include_str!("inline.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -28,7 +28,7 @@ fn test_inline() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_inline_fail() {
|
fn test_inline_fail() {
|
||||||
let bytes = include_bytes!("inline_fail.leo");
|
let bytes = include_str!("inline_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -36,7 +36,7 @@ fn test_inline_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_inline_undefined() {
|
fn test_inline_undefined() {
|
||||||
let bytes = include_bytes!("inline_undefined.leo");
|
let bytes = include_str!("inline_undefined.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -46,7 +46,7 @@ fn test_inline_undefined() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_variable() {
|
fn test_member_variable() {
|
||||||
let bytes = include_bytes!("member_variable.leo");
|
let bytes = include_str!("member_variable.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -54,7 +54,7 @@ fn test_member_variable() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_variable_fail() {
|
fn test_member_variable_fail() {
|
||||||
let bytes = include_bytes!("member_variable_fail.leo");
|
let bytes = include_str!("member_variable_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -62,7 +62,7 @@ fn test_member_variable_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_variable_and_function() {
|
fn test_member_variable_and_function() {
|
||||||
let bytes = include_bytes!("member_variable_and_function.leo");
|
let bytes = include_str!("member_variable_and_function.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -70,7 +70,7 @@ fn test_member_variable_and_function() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_function() {
|
fn test_member_function() {
|
||||||
let bytes = include_bytes!("member_function.leo");
|
let bytes = include_str!("member_function.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -78,7 +78,7 @@ fn test_member_function() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_function_fail() {
|
fn test_member_function_fail() {
|
||||||
let bytes = include_bytes!("member_function_fail.leo");
|
let bytes = include_str!("member_function_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -86,7 +86,7 @@ fn test_member_function_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_function_invalid() {
|
fn test_member_function_invalid() {
|
||||||
let bytes = include_bytes!("member_function_invalid.leo");
|
let bytes = include_str!("member_function_invalid.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -94,7 +94,7 @@ fn test_member_function_invalid() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_function_nested() {
|
fn test_member_function_nested() {
|
||||||
let bytes = include_bytes!("member_function_nested.leo");
|
let bytes = include_str!("member_function_nested.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -102,7 +102,7 @@ fn test_member_function_nested() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_static_function() {
|
fn test_member_static_function() {
|
||||||
let bytes = include_bytes!("member_static_function.leo");
|
let bytes = include_str!("member_static_function.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -110,7 +110,7 @@ fn test_member_static_function() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_static_function_nested() {
|
fn test_member_static_function_nested() {
|
||||||
let bytes = include_bytes!("member_static_function_nested.leo");
|
let bytes = include_str!("member_static_function_nested.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -118,7 +118,7 @@ fn test_member_static_function_nested() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_static_function_invalid() {
|
fn test_member_static_function_invalid() {
|
||||||
let bytes = include_bytes!("member_static_function_invalid.leo");
|
let bytes = include_str!("member_static_function_invalid.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error)
|
expect_type_inference_error(error)
|
||||||
@ -126,7 +126,7 @@ fn test_member_static_function_invalid() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_member_static_function_undefined() {
|
fn test_member_static_function_undefined() {
|
||||||
let bytes = include_bytes!("member_static_function_undefined.leo");
|
let bytes = include_str!("member_static_function_undefined.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error)
|
expect_type_inference_error(error)
|
||||||
@ -136,7 +136,7 @@ fn test_member_static_function_undefined() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_function_fail() {
|
fn test_mutate_function_fail() {
|
||||||
let bytes = include_bytes!("mut_function_fail.leo");
|
let bytes = include_str!("mut_function_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -144,7 +144,7 @@ fn test_mutate_function_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_self_variable() {
|
fn test_mutate_self_variable() {
|
||||||
let bytes = include_bytes!("mut_self_variable.leo");
|
let bytes = include_str!("mut_self_variable.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -152,7 +152,7 @@ fn test_mutate_self_variable() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_self_variable_fail() {
|
fn test_mutate_self_variable_fail() {
|
||||||
let bytes = include_bytes!("mut_self_variable_fail.leo");
|
let bytes = include_str!("mut_self_variable_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -160,7 +160,7 @@ fn test_mutate_self_variable_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_self_function_fail() {
|
fn test_mutate_self_function_fail() {
|
||||||
let bytes = include_bytes!("mut_self_function_fail.leo");
|
let bytes = include_str!("mut_self_function_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -168,7 +168,7 @@ fn test_mutate_self_function_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_self_static_function_fail() {
|
fn test_mutate_self_static_function_fail() {
|
||||||
let bytes = include_bytes!("mut_self_static_function_fail.leo");
|
let bytes = include_str!("mut_self_static_function_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -176,7 +176,7 @@ fn test_mutate_self_static_function_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_static_function_fail() {
|
fn test_mutate_static_function_fail() {
|
||||||
let bytes = include_bytes!("mut_static_function_fail.leo");
|
let bytes = include_str!("mut_static_function_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -184,7 +184,7 @@ fn test_mutate_static_function_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_variable() {
|
fn test_mutate_variable() {
|
||||||
let bytes = include_bytes!("mut_variable.leo");
|
let bytes = include_str!("mut_variable.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -192,7 +192,7 @@ fn test_mutate_variable() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate_variable_fail() {
|
fn test_mutate_variable_fail() {
|
||||||
let bytes = include_bytes!("mut_variable_fail.leo");
|
let bytes = include_str!("mut_variable_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -202,7 +202,7 @@ fn test_mutate_variable_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_fail() {
|
fn test_self_fail() {
|
||||||
let bytes = include_bytes!("self_fail.leo");
|
let bytes = include_str!("self_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -210,7 +210,7 @@ fn test_self_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_member_pass() {
|
fn test_self_member_pass() {
|
||||||
let bytes = include_bytes!("self_member.leo");
|
let bytes = include_str!("self_member.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -218,7 +218,7 @@ fn test_self_member_pass() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_member_invalid() {
|
fn test_self_member_invalid() {
|
||||||
let bytes = include_bytes!("self_member_invalid.leo");
|
let bytes = include_str!("self_member_invalid.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
@ -226,7 +226,7 @@ fn test_self_member_invalid() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_member_undefined() {
|
fn test_self_member_undefined() {
|
||||||
let bytes = include_bytes!("self_member_undefined.leo");
|
let bytes = include_str!("self_member_undefined.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -236,7 +236,7 @@ fn test_self_member_undefined() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pedersen_mock() {
|
fn test_pedersen_mock() {
|
||||||
let bytes = include_bytes!("pedersen_mock.leo");
|
let bytes = include_str!("pedersen_mock.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -244,7 +244,7 @@ fn test_pedersen_mock() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_define_circuit_inside_circuit_function() {
|
fn test_define_circuit_inside_circuit_function() {
|
||||||
let bytes = include_bytes!("define_circuit_inside_circuit_function.leo");
|
let bytes = include_str!("define_circuit_inside_circuit_function.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
|
@ -19,7 +19,7 @@ use leo_ast::InputValue;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log() {
|
fn test_log() {
|
||||||
let bytes = include_bytes!("log.leo");
|
let bytes = include_str!("log.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -27,14 +27,14 @@ fn test_log() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_fail() {
|
fn test_log_fail() {
|
||||||
let bytes = include_bytes!("log_fail.leo");
|
let bytes = include_str!("log_fail.leo");
|
||||||
|
|
||||||
assert!(parse_program(bytes).is_err());
|
assert!(parse_program(bytes).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_parameter() {
|
fn test_log_parameter() {
|
||||||
let bytes = include_bytes!("log_parameter.leo");
|
let bytes = include_str!("log_parameter.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -42,7 +42,7 @@ fn test_log_parameter() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_parameter_many() {
|
fn test_log_parameter_many() {
|
||||||
let bytes = include_bytes!("log_parameter_many.leo");
|
let bytes = include_str!("log_parameter_many.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -50,7 +50,7 @@ fn test_log_parameter_many() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_parameter_fail_unknown() {
|
fn test_log_parameter_fail_unknown() {
|
||||||
let bytes = include_bytes!("log_parameter_fail_unknown.leo");
|
let bytes = include_str!("log_parameter_fail_unknown.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -58,7 +58,7 @@ fn test_log_parameter_fail_unknown() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_parameter_fail_empty() {
|
fn test_log_parameter_fail_empty() {
|
||||||
let bytes = include_bytes!("log_parameter_fail_empty.leo");
|
let bytes = include_str!("log_parameter_fail_empty.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -66,7 +66,7 @@ fn test_log_parameter_fail_empty() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_parameter_fail_none() {
|
fn test_log_parameter_fail_none() {
|
||||||
let bytes = include_bytes!("log_parameter_fail_empty.leo");
|
let bytes = include_str!("log_parameter_fail_empty.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -74,7 +74,7 @@ fn test_log_parameter_fail_none() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_input() {
|
fn test_log_input() {
|
||||||
let bytes = include_bytes!("log_input.leo");
|
let bytes = include_str!("log_input.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
||||||
@ -88,7 +88,7 @@ fn test_log_input() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_debug() {
|
fn test_debug() {
|
||||||
let bytes = include_bytes!("debug.leo");
|
let bytes = include_str!("debug.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -98,7 +98,7 @@ fn test_debug() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error() {
|
fn test_error() {
|
||||||
let bytes = include_bytes!("error.leo");
|
let bytes = include_str!("error.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -108,7 +108,7 @@ fn test_error() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_assert() {
|
fn test_assert() {
|
||||||
let bytes = include_bytes!("assert.leo");
|
let bytes = include_str!("assert.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
||||||
@ -128,7 +128,7 @@ fn test_assert() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_conditional_assert() {
|
fn test_conditional_assert() {
|
||||||
let bytes = include_bytes!("conditional_assert.leo");
|
let bytes = include_str!("conditional_assert.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
||||||
|
@ -20,7 +20,7 @@ use crate::{assert_satisfied, expect_symbol_table_error, parse_program};
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_core_circuit_invalid() {
|
fn test_core_circuit_invalid() {
|
||||||
let program_bytes = include_bytes!("core_package_invalid.leo");
|
let program_bytes = include_str!("core_package_invalid.leo");
|
||||||
let program = parse_program(program_bytes).err().unwrap();
|
let program = parse_program(program_bytes).err().unwrap();
|
||||||
|
|
||||||
expect_symbol_table_error(program);
|
expect_symbol_table_error(program);
|
||||||
@ -28,7 +28,7 @@ fn test_core_circuit_invalid() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_core_circuit_star_fail() {
|
fn test_core_circuit_star_fail() {
|
||||||
let program_bytes = include_bytes!("core_circuit_star_fail.leo");
|
let program_bytes = include_str!("core_circuit_star_fail.leo");
|
||||||
let error = parse_program(program_bytes).err().unwrap();
|
let error = parse_program(program_bytes).err().unwrap();
|
||||||
|
|
||||||
expect_symbol_table_error(error);
|
expect_symbol_table_error(error);
|
||||||
@ -36,7 +36,7 @@ fn test_core_circuit_star_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_core_package_invalid() {
|
fn test_core_package_invalid() {
|
||||||
let program_bytes = include_bytes!("core_package_invalid.leo");
|
let program_bytes = include_str!("core_package_invalid.leo");
|
||||||
let error = parse_program(program_bytes).err().unwrap();
|
let error = parse_program(program_bytes).err().unwrap();
|
||||||
|
|
||||||
expect_symbol_table_error(error);
|
expect_symbol_table_error(error);
|
||||||
@ -44,7 +44,7 @@ fn test_core_package_invalid() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_core_unstable_package_invalid() {
|
fn test_core_unstable_package_invalid() {
|
||||||
let program_bytes = include_bytes!("core_unstable_package_invalid.leo");
|
let program_bytes = include_str!("core_unstable_package_invalid.leo");
|
||||||
let error = parse_program(program_bytes).err().unwrap();
|
let error = parse_program(program_bytes).err().unwrap();
|
||||||
|
|
||||||
expect_symbol_table_error(error);
|
expect_symbol_table_error(error);
|
||||||
@ -52,7 +52,7 @@ fn test_core_unstable_package_invalid() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_unstable_blake2s_sanity() {
|
fn test_unstable_blake2s_sanity() {
|
||||||
let program_bytes = include_bytes!("unstable_blake2s.leo");
|
let program_bytes = include_str!("unstable_blake2s.leo");
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
|
@ -32,7 +32,7 @@ use snarkos_models::algorithms::PRF;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_arguments_length_fail() {
|
fn test_arguments_length_fail() {
|
||||||
let program_bytes = include_bytes!("arguments_length_fail.leo");
|
let program_bytes = include_str!("arguments_length_fail.leo");
|
||||||
let error = parse_program(program_bytes).err().unwrap();
|
let error = parse_program(program_bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -40,7 +40,7 @@ fn test_arguments_length_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_arguments_type_fail() {
|
fn test_arguments_type_fail() {
|
||||||
let program_bytes = include_bytes!("arguments_type_fail.leo");
|
let program_bytes = include_str!("arguments_type_fail.leo");
|
||||||
let error = parse_program(program_bytes).err().unwrap();
|
let error = parse_program(program_bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -80,7 +80,7 @@ fn test_blake2s_random() {
|
|||||||
|
|
||||||
// The `blake2s_random.leo` program will compute a blake2s hash digest and compare it against
|
// The `blake2s_random.leo` program will compute a blake2s hash digest and compare it against
|
||||||
// the expected value
|
// the expected value
|
||||||
let bytes = include_bytes!("blake2s_random.leo");
|
let bytes = include_str!("blake2s_random.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
|
@ -18,7 +18,7 @@ use crate::{assert_satisfied, import::set_local_dir, parse_program};
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_out_of_order() {
|
fn test_out_of_order() {
|
||||||
let program_bytes = include_bytes!("out_of_order.leo");
|
let program_bytes = include_str!("out_of_order.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ fn test_out_of_order() {
|
|||||||
fn test_out_of_order_with_import() {
|
fn test_out_of_order_with_import() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let program_bytes = include_bytes!("out_of_order_with_import.leo");
|
let program_bytes = include_str!("out_of_order_with_import.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ fn test_negate() {
|
|||||||
let a_string = field_to_decimal_string(a);
|
let a_string = field_to_decimal_string(a);
|
||||||
let b_string = field_to_decimal_string(b);
|
let b_string = field_to_decimal_string(b);
|
||||||
|
|
||||||
let bytes = include_bytes!("negate.leo");
|
let bytes = include_str!("negate.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -81,7 +81,7 @@ fn test_add() {
|
|||||||
let b_string = field_to_decimal_string(b);
|
let b_string = field_to_decimal_string(b);
|
||||||
let c_string = field_to_decimal_string(c);
|
let c_string = field_to_decimal_string(c);
|
||||||
|
|
||||||
let bytes = include_bytes!("add.leo");
|
let bytes = include_str!("add.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -111,7 +111,7 @@ fn test_sub() {
|
|||||||
let b_string = field_to_decimal_string(b);
|
let b_string = field_to_decimal_string(b);
|
||||||
let c_string = field_to_decimal_string(c);
|
let c_string = field_to_decimal_string(c);
|
||||||
|
|
||||||
let bytes = include_bytes!("sub.leo");
|
let bytes = include_str!("sub.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -140,7 +140,7 @@ fn test_div() {
|
|||||||
let b_string = field_to_decimal_string(b);
|
let b_string = field_to_decimal_string(b);
|
||||||
let c_string = field_to_decimal_string(c);
|
let c_string = field_to_decimal_string(c);
|
||||||
|
|
||||||
let bytes = include_bytes!("div.leo");
|
let bytes = include_str!("div.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -169,7 +169,7 @@ fn test_mul() {
|
|||||||
let b_string = field_to_decimal_string(b);
|
let b_string = field_to_decimal_string(b);
|
||||||
let c_string = field_to_decimal_string(c);
|
let c_string = field_to_decimal_string(c);
|
||||||
|
|
||||||
let bytes = include_bytes!("mul.leo");
|
let bytes = include_str!("mul.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -197,7 +197,7 @@ fn test_eq() {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("eq.leo");
|
let bytes = include_str!("eq.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -237,7 +237,7 @@ fn test_console_assert_pass() {
|
|||||||
|
|
||||||
let a_string = field_to_decimal_string(a);
|
let a_string = field_to_decimal_string(a);
|
||||||
|
|
||||||
let bytes = include_bytes!("console_assert.leo");
|
let bytes = include_str!("console_assert.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -266,7 +266,7 @@ fn test_console_assert_fail() {
|
|||||||
let a_string = field_to_decimal_string(a);
|
let a_string = field_to_decimal_string(a);
|
||||||
let b_string = field_to_decimal_string(b);
|
let b_string = field_to_decimal_string(b);
|
||||||
|
|
||||||
let bytes = include_bytes!("console_assert.leo");
|
let bytes = include_str!("console_assert.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -290,7 +290,7 @@ fn test_ternary() {
|
|||||||
let a_string = field_to_decimal_string(a);
|
let a_string = field_to_decimal_string(a);
|
||||||
let b_string = field_to_decimal_string(b);
|
let b_string = field_to_decimal_string(b);
|
||||||
|
|
||||||
let bytes = include_bytes!("ternary.leo");
|
let bytes = include_str!("ternary.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
// true -> field a
|
// true -> field a
|
||||||
@ -322,14 +322,14 @@ fn test_ternary() {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// pub fn output_one(program: EdwardsTestCompiler) {
|
// pub fn output_one(program: EdwardsTestCompiler) {
|
||||||
// let expected = include_bytes!("output_/register_one.out");
|
// let expected = include_str!("output_/register_one.out");
|
||||||
// let actual = get_output(program);
|
// let actual = get_output(program);
|
||||||
//
|
//
|
||||||
// assert_eq!(expected, actual.bytes().as_slice());
|
// assert_eq!(expected, actual.bytes().as_slice());
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// pub fn output_zero(program: EdwardsTestCompiler) {
|
// pub fn output_zero(program: EdwardsTestCompiler) {
|
||||||
// let expected = include_bytes!("output_/register_zero.out");
|
// let expected = include_str!("output_/register_zero.out");
|
||||||
// let actual = get_output(program);
|
// let actual = get_output(program);
|
||||||
//
|
//
|
||||||
// assert_eq!(expected, actual.bytes().as_slice());
|
// assert_eq!(expected, actual.bytes().as_slice());
|
||||||
@ -337,9 +337,9 @@ fn test_ternary() {
|
|||||||
//
|
//
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn test_registers() {
|
// fn test_registers() {
|
||||||
// let program_bytes = include_bytes!("output_register.leo");
|
// let program_bytes = include_str!("output_register.leo");
|
||||||
// let one_input_bytes = include_bytes!("input/register_one.in");
|
// let one_input_bytes = include_str!("input/register_one.in");
|
||||||
// let zero_input_bytes = include_bytes!("input/register_zero.in");
|
// let zero_input_bytes = include_str!("input/register_zero.in");
|
||||||
//
|
//
|
||||||
// // test 1field input register => 1field output register
|
// // test 1field input register => 1field output register
|
||||||
// let program = parse_program_with_input(program_bytes, one_input_bytes).unwrap();
|
// let program = parse_program_with_input(program_bytes, one_input_bytes).unwrap();
|
||||||
|
@ -26,7 +26,7 @@ use leo_compiler::errors::{CompilerError, ExpressionError, FunctionError, Statem
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_empty() {
|
fn test_empty() {
|
||||||
let bytes = include_bytes!("empty.leo");
|
let bytes = include_str!("empty.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -34,7 +34,7 @@ fn test_empty() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_iteration() {
|
fn test_iteration() {
|
||||||
let bytes = include_bytes!("iteration.leo");
|
let bytes = include_str!("iteration.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -42,7 +42,7 @@ fn test_iteration() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_iteration_repeated() {
|
fn test_iteration_repeated() {
|
||||||
let bytes = include_bytes!("iteration_repeated.leo");
|
let bytes = include_str!("iteration_repeated.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -63,7 +63,7 @@ fn test_newlines() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multiple_returns() {
|
fn test_multiple_returns() {
|
||||||
let bytes = include_bytes!("multiple.leo");
|
let bytes = include_str!("multiple.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -85,7 +85,7 @@ fn test_multiple_returns_main() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_repeated_function_call() {
|
fn test_repeated_function_call() {
|
||||||
let bytes = include_bytes!("repeated.leo");
|
let bytes = include_str!("repeated.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -93,7 +93,7 @@ fn test_repeated_function_call() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_return() {
|
fn test_return() {
|
||||||
let bytes = include_bytes!("return.leo");
|
let bytes = include_str!("return.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -101,7 +101,7 @@ fn test_return() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_scope_fail() {
|
fn test_scope_fail() {
|
||||||
let bytes = include_bytes!("scope_fail.leo");
|
let bytes = include_str!("scope_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
match expect_compiler_error(program) {
|
match expect_compiler_error(program) {
|
||||||
@ -117,7 +117,7 @@ fn test_scope_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_undefined() {
|
fn test_undefined() {
|
||||||
let bytes = include_bytes!("undefined.leo");
|
let bytes = include_str!("undefined.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -125,7 +125,7 @@ fn test_undefined() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_value_unchanged() {
|
fn test_value_unchanged() {
|
||||||
let bytes = include_bytes!("value_unchanged.leo");
|
let bytes = include_str!("value_unchanged.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -133,7 +133,7 @@ fn test_value_unchanged() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_array_input() {
|
fn test_array_input() {
|
||||||
let bytes = include_bytes!("array_input.leo");
|
let bytes = include_str!("array_input.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error)
|
expect_type_inference_error(error)
|
||||||
@ -143,7 +143,7 @@ fn test_array_input() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_return_array_nested_fail() {
|
fn test_return_array_nested_fail() {
|
||||||
let bytes = include_bytes!("return_array_nested_fail.leo");
|
let bytes = include_str!("return_array_nested_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
@ -151,7 +151,7 @@ fn test_return_array_nested_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_return_array_nested_pass() {
|
fn test_return_array_nested_pass() {
|
||||||
let bytes = include_bytes!("return_array_nested_pass.leo");
|
let bytes = include_str!("return_array_nested_pass.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -159,7 +159,7 @@ fn test_return_array_nested_pass() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_return_array_tuple_fail() {
|
fn test_return_array_tuple_fail() {
|
||||||
let bytes = include_bytes!("return_array_tuple_fail.leo");
|
let bytes = include_str!("return_array_tuple_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let _err = expect_compiler_error(program);
|
let _err = expect_compiler_error(program);
|
||||||
@ -167,7 +167,7 @@ fn test_return_array_tuple_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_return_array_tuple_pass() {
|
fn test_return_array_tuple_pass() {
|
||||||
let bytes = include_bytes!("return_array_tuple_pass.leo");
|
let bytes = include_str!("return_array_tuple_pass.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -177,7 +177,7 @@ fn test_return_array_tuple_pass() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_return_tuple() {
|
fn test_return_tuple() {
|
||||||
let bytes = include_bytes!("return_tuple.leo");
|
let bytes = include_str!("return_tuple.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -185,7 +185,7 @@ fn test_return_tuple() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_return_tuple_conditional() {
|
fn test_return_tuple_conditional() {
|
||||||
let bytes = include_bytes!("return_tuple_conditional.leo");
|
let bytes = include_str!("return_tuple_conditional.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
|
@ -15,8 +15,13 @@
|
|||||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
assert_satisfied, expect_compiler_error, expect_synthesis_error, field::field_to_decimal_string,
|
assert_satisfied,
|
||||||
generate_main_input, parse_program, parse_program_with_input,
|
expect_compiler_error,
|
||||||
|
expect_synthesis_error,
|
||||||
|
field::field_to_decimal_string,
|
||||||
|
generate_main_input,
|
||||||
|
parse_program,
|
||||||
|
parse_program_with_input,
|
||||||
};
|
};
|
||||||
use leo_ast::{GroupCoordinate, GroupTuple, GroupValue, InputValue, Span};
|
use leo_ast::{GroupCoordinate, GroupTuple, GroupValue, InputValue, Span};
|
||||||
|
|
||||||
@ -47,7 +52,7 @@ pub fn group_element_to_input_value(g: EdwardsAffine) -> GroupValue {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_one() {
|
fn test_one() {
|
||||||
let bytes = include_bytes!("one.leo");
|
let bytes = include_str!("one.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -55,7 +60,7 @@ fn test_one() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_zero() {
|
fn test_zero() {
|
||||||
let bytes = include_bytes!("zero.leo");
|
let bytes = include_str!("zero.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -63,7 +68,7 @@ fn test_zero() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_point() {
|
fn test_point() {
|
||||||
let bytes = include_bytes!("point.leo");
|
let bytes = include_str!("point.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -71,7 +76,7 @@ fn test_point() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_x_sign_high() {
|
fn test_x_sign_high() {
|
||||||
let bytes = include_bytes!("x_sign_high.leo");
|
let bytes = include_str!("x_sign_high.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -79,7 +84,7 @@ fn test_x_sign_high() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_x_sign_low() {
|
fn test_x_sign_low() {
|
||||||
let bytes = include_bytes!("x_sign_low.leo");
|
let bytes = include_str!("x_sign_low.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -87,7 +92,7 @@ fn test_x_sign_low() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_x_sign_inferred() {
|
fn test_x_sign_inferred() {
|
||||||
let bytes = include_bytes!("x_sign_inferred.leo");
|
let bytes = include_str!("x_sign_inferred.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -95,7 +100,7 @@ fn test_x_sign_inferred() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_y_sign_high() {
|
fn test_y_sign_high() {
|
||||||
let bytes = include_bytes!("y_sign_high.leo");
|
let bytes = include_str!("y_sign_high.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -103,7 +108,7 @@ fn test_y_sign_high() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_y_sign_low() {
|
fn test_y_sign_low() {
|
||||||
let bytes = include_bytes!("y_sign_low.leo");
|
let bytes = include_str!("y_sign_low.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -111,7 +116,7 @@ fn test_y_sign_low() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_y_sign_inferred() {
|
fn test_y_sign_inferred() {
|
||||||
let bytes = include_bytes!("y_sign_inferred.leo");
|
let bytes = include_str!("y_sign_inferred.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -119,7 +124,7 @@ fn test_y_sign_inferred() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_both_sign_high() {
|
fn test_both_sign_high() {
|
||||||
let bytes = include_bytes!("both_sign_high.leo");
|
let bytes = include_str!("both_sign_high.leo");
|
||||||
|
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
@ -128,7 +133,7 @@ fn test_both_sign_high() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_both_sign_low() {
|
fn test_both_sign_low() {
|
||||||
let bytes = include_bytes!("both_sign_low.leo");
|
let bytes = include_str!("both_sign_low.leo");
|
||||||
|
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
@ -137,7 +142,7 @@ fn test_both_sign_low() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_both_sign_inferred() {
|
fn test_both_sign_inferred() {
|
||||||
let bytes = include_bytes!("both_sign_inferred.leo");
|
let bytes = include_str!("both_sign_inferred.leo");
|
||||||
|
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
@ -146,8 +151,8 @@ fn test_both_sign_inferred() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_point_input() {
|
fn test_point_input() {
|
||||||
let program_bytes = include_bytes!("point_input.leo");
|
let program_bytes = include_str!("point_input.leo");
|
||||||
let input_bytes = include_bytes!("input/point.in");
|
let input_bytes = include_str!("input/point.in");
|
||||||
|
|
||||||
let program = parse_program_with_input(program_bytes, input_bytes).unwrap();
|
let program = parse_program_with_input(program_bytes, input_bytes).unwrap();
|
||||||
|
|
||||||
@ -156,9 +161,9 @@ fn test_point_input() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_input() {
|
fn test_input() {
|
||||||
let program_bytes = include_bytes!("input.leo");
|
let program_bytes = include_str!("input.leo");
|
||||||
let input_bytes_pass = include_bytes!("input/valid.in");
|
let input_bytes_pass = include_str!("input/valid.in");
|
||||||
let input_bytes_fail = include_bytes!("input/invalid.in");
|
let input_bytes_fail = include_str!("input/invalid.in");
|
||||||
|
|
||||||
let program = parse_program_with_input(program_bytes, input_bytes_pass).unwrap();
|
let program = parse_program_with_input(program_bytes, input_bytes_pass).unwrap();
|
||||||
|
|
||||||
@ -182,7 +187,7 @@ fn test_negate() {
|
|||||||
let a_element = group_element_to_input_value(a);
|
let a_element = group_element_to_input_value(a);
|
||||||
let b_element = group_element_to_input_value(b);
|
let b_element = group_element_to_input_value(b);
|
||||||
|
|
||||||
let bytes = include_bytes!("negate.leo");
|
let bytes = include_str!("negate.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -210,7 +215,7 @@ fn test_add() {
|
|||||||
let b_element = group_element_to_input_value(b);
|
let b_element = group_element_to_input_value(b);
|
||||||
let c_element = group_element_to_input_value(c);
|
let c_element = group_element_to_input_value(c);
|
||||||
|
|
||||||
let bytes = include_bytes!("add.leo");
|
let bytes = include_str!("add.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -239,7 +244,7 @@ fn test_sub() {
|
|||||||
let b_element = group_element_to_input_value(b);
|
let b_element = group_element_to_input_value(b);
|
||||||
let c_element = group_element_to_input_value(c);
|
let c_element = group_element_to_input_value(c);
|
||||||
|
|
||||||
let bytes = include_bytes!("sub.leo");
|
let bytes = include_str!("sub.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -262,7 +267,7 @@ fn test_console_assert_pass() {
|
|||||||
|
|
||||||
let a_element = group_element_to_input_value(a);
|
let a_element = group_element_to_input_value(a);
|
||||||
|
|
||||||
let bytes = include_bytes!("assert_eq.leo");
|
let bytes = include_str!("assert_eq.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -291,7 +296,7 @@ fn test_console_assert_fail() {
|
|||||||
let a_element = group_element_to_input_value(a);
|
let a_element = group_element_to_input_value(a);
|
||||||
let b_element = group_element_to_input_value(b);
|
let b_element = group_element_to_input_value(b);
|
||||||
|
|
||||||
let bytes = include_bytes!("assert_eq.leo");
|
let bytes = include_str!("assert_eq.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -318,7 +323,7 @@ fn test_eq() {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("eq.leo");
|
let bytes = include_str!("eq.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -359,7 +364,7 @@ fn test_ternary() {
|
|||||||
let a_element = group_element_to_input_value(a);
|
let a_element = group_element_to_input_value(a);
|
||||||
let b_element = group_element_to_input_value(b);
|
let b_element = group_element_to_input_value(b);
|
||||||
|
|
||||||
let bytes = include_bytes!("ternary.leo");
|
let bytes = include_str!("ternary.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
// true -> field a
|
// true -> field a
|
||||||
|
@ -34,7 +34,7 @@ pub fn set_local_dir() {
|
|||||||
fn test_basic() {
|
fn test_basic() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("basic.leo");
|
let bytes = include_str!("basic.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -45,7 +45,7 @@ fn test_basic() {
|
|||||||
fn test_multiple() {
|
fn test_multiple() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("multiple.leo");
|
let bytes = include_str!("multiple.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -56,7 +56,7 @@ fn test_multiple() {
|
|||||||
fn test_star() {
|
fn test_star() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("star.leo");
|
let bytes = include_str!("star.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -67,7 +67,7 @@ fn test_star() {
|
|||||||
fn test_star_fail() {
|
fn test_star_fail() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("star_fail.leo");
|
let bytes = include_str!("star_fail.leo");
|
||||||
assert!(parse_program(bytes).is_err());
|
assert!(parse_program(bytes).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ fn test_star_fail() {
|
|||||||
fn test_alias() {
|
fn test_alias() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("alias.leo");
|
let bytes = include_str!("alias.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -88,7 +88,7 @@ fn test_alias() {
|
|||||||
fn test_names_pass() {
|
fn test_names_pass() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("names.leo");
|
let bytes = include_str!("names.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -99,7 +99,7 @@ fn test_names_pass() {
|
|||||||
fn test_names_fail_1() {
|
fn test_names_fail_1() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("names_dash_a.leo");
|
let bytes = include_str!("names_dash_a.leo");
|
||||||
assert!(parse_program(bytes).is_err());
|
assert!(parse_program(bytes).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ fn test_names_fail_1() {
|
|||||||
fn test_names_fail_2() {
|
fn test_names_fail_2() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("names_a_dash.leo");
|
let bytes = include_str!("names_a_dash.leo");
|
||||||
assert!(parse_program(bytes).is_err());
|
assert!(parse_program(bytes).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ fn test_names_fail_2() {
|
|||||||
fn test_names_fail_3() {
|
fn test_names_fail_3() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("names_underscore.leo");
|
let bytes = include_str!("names_underscore.leo");
|
||||||
assert!(parse_program(bytes).is_err());
|
assert!(parse_program(bytes).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ fn test_names_fail_3() {
|
|||||||
fn test_names_fail_4() {
|
fn test_names_fail_4() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("names_dollar.leo");
|
let bytes = include_str!("names_dollar.leo");
|
||||||
assert!(parse_program(bytes).is_err());
|
assert!(parse_program(bytes).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ fn test_names_fail_4() {
|
|||||||
fn test_many_import() {
|
fn test_many_import() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("many_import.leo");
|
let bytes = include_str!("many_import.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -147,7 +147,7 @@ fn test_many_import() {
|
|||||||
fn test_many_import_star() {
|
fn test_many_import_star() {
|
||||||
set_local_dir();
|
set_local_dir();
|
||||||
|
|
||||||
let bytes = include_bytes!("many_import_star.leo");
|
let bytes = include_str!("many_import_star.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
|
@ -28,7 +28,7 @@ macro_rules! test_int {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("negate.leo");
|
let bytes = include_str!("negate.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
("a", Some(InputValue::Integer($integer_type, a.to_string()))),
|
("a", Some(InputValue::Integer($integer_type, a.to_string()))),
|
||||||
@ -42,14 +42,14 @@ macro_rules! test_int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_negate_min_fail() {
|
fn test_negate_min_fail() {
|
||||||
let bytes = include_bytes!("negate_min.leo");
|
let bytes = include_str!("negate_min.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_computation_error(program);
|
expect_computation_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_negate_zero() {
|
fn test_negate_zero() {
|
||||||
let bytes = include_bytes!("negate_zero.leo");
|
let bytes = include_str!("negate_zero.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -58,28 +58,28 @@ macro_rules! test_int {
|
|||||||
|
|
||||||
impl IntegerTester for $name {
|
impl IntegerTester for $name {
|
||||||
fn test_min() {
|
fn test_min() {
|
||||||
let bytes = include_bytes!("min.leo");
|
let bytes = include_str!("min.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_min_fail() {
|
fn test_min_fail() {
|
||||||
let bytes = include_bytes!("min_fail.leo");
|
let bytes = include_str!("min_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_parsing_error(program);
|
expect_parsing_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_max() {
|
fn test_max() {
|
||||||
let bytes = include_bytes!("max.leo");
|
let bytes = include_str!("max.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_max_fail() {
|
fn test_max_fail() {
|
||||||
let bytes = include_bytes!("max_fail.leo");
|
let bytes = include_str!("max_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_parsing_error(program);
|
expect_parsing_error(program);
|
||||||
@ -95,7 +95,7 @@ macro_rules! test_int {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("add.leo");
|
let bytes = include_str!("add.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -124,7 +124,7 @@ macro_rules! test_int {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("sub.leo");
|
let bytes = include_str!("sub.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -149,7 +149,7 @@ macro_rules! test_int {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("mul.leo");
|
let bytes = include_str!("mul.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -176,7 +176,7 @@ macro_rules! test_int {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bytes = include_bytes!("div.leo");
|
let bytes = include_str!("div.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
// expect an error when dividing by zero
|
// expect an error when dividing by zero
|
||||||
@ -220,7 +220,7 @@ macro_rules! test_int {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("pow.leo");
|
let bytes = include_str!("pow.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -242,7 +242,7 @@ macro_rules! test_int {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("eq.leo");
|
let bytes = include_str!("eq.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -280,7 +280,7 @@ macro_rules! test_int {
|
|||||||
|
|
||||||
// test a != a == false
|
// test a != a == false
|
||||||
|
|
||||||
let bytes = include_bytes!("ne.leo");
|
let bytes = include_str!("ne.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -318,7 +318,7 @@ macro_rules! test_int {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("ge.leo");
|
let bytes = include_str!("ge.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -356,7 +356,7 @@ macro_rules! test_int {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("gt.leo");
|
let bytes = include_str!("gt.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -394,7 +394,7 @@ macro_rules! test_int {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("le.leo");
|
let bytes = include_str!("le.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -432,7 +432,7 @@ macro_rules! test_int {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("lt.leo");
|
let bytes = include_str!("lt.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -468,7 +468,7 @@ macro_rules! test_int {
|
|||||||
let a: $type_ = rand::random();
|
let a: $type_ = rand::random();
|
||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
let bytes = include_bytes!("console_assert.leo");
|
let bytes = include_str!("console_assert.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -504,7 +504,7 @@ macro_rules! test_int {
|
|||||||
let a: $type_ = rand::random();
|
let a: $type_ = rand::random();
|
||||||
let b: $type_ = rand::random();
|
let b: $type_ = rand::random();
|
||||||
|
|
||||||
let bytes = include_bytes!("ternary.leo");
|
let bytes = include_str!("ternary.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
// true -> field 1
|
// true -> field 1
|
||||||
|
@ -20,28 +20,28 @@ macro_rules! test_uint {
|
|||||||
|
|
||||||
impl IntegerTester for $name {
|
impl IntegerTester for $name {
|
||||||
fn test_min() {
|
fn test_min() {
|
||||||
let bytes = include_bytes!("min.leo");
|
let bytes = include_str!("min.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_min_fail() {
|
fn test_min_fail() {
|
||||||
let bytes = include_bytes!("min_fail.leo");
|
let bytes = include_str!("min_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_parsing_error(program);
|
expect_parsing_error(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_max() {
|
fn test_max() {
|
||||||
let bytes = include_bytes!("max.leo");
|
let bytes = include_str!("max.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_max_fail() {
|
fn test_max_fail() {
|
||||||
let bytes = include_bytes!("max_fail.leo");
|
let bytes = include_str!("max_fail.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_parsing_error(program);
|
expect_parsing_error(program);
|
||||||
@ -57,7 +57,7 @@ macro_rules! test_uint {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("add.leo");
|
let bytes = include_str!("add.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -82,7 +82,7 @@ macro_rules! test_uint {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("sub.leo");
|
let bytes = include_str!("sub.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -107,7 +107,7 @@ macro_rules! test_uint {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("mul.leo");
|
let bytes = include_str!("mul.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -132,7 +132,7 @@ macro_rules! test_uint {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("div.leo");
|
let bytes = include_str!("div.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -158,7 +158,7 @@ macro_rules! test_uint {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = include_bytes!("pow.leo");
|
let bytes = include_str!("pow.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -180,7 +180,7 @@ macro_rules! test_uint {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("eq.leo");
|
let bytes = include_str!("eq.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -218,7 +218,7 @@ macro_rules! test_uint {
|
|||||||
|
|
||||||
// test a != a == false
|
// test a != a == false
|
||||||
|
|
||||||
let bytes = include_bytes!("ne.leo");
|
let bytes = include_str!("ne.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -256,7 +256,7 @@ macro_rules! test_uint {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("ge.leo");
|
let bytes = include_str!("ge.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -294,7 +294,7 @@ macro_rules! test_uint {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("gt.leo");
|
let bytes = include_str!("gt.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -332,7 +332,7 @@ macro_rules! test_uint {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("le.leo");
|
let bytes = include_str!("le.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -370,7 +370,7 @@ macro_rules! test_uint {
|
|||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
|
|
||||||
let bytes = include_bytes!("lt.leo");
|
let bytes = include_str!("lt.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -406,7 +406,7 @@ macro_rules! test_uint {
|
|||||||
let a: $type_ = rand::random();
|
let a: $type_ = rand::random();
|
||||||
|
|
||||||
// test equal
|
// test equal
|
||||||
let bytes = include_bytes!("console_assert.leo");
|
let bytes = include_str!("console_assert.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -442,7 +442,7 @@ macro_rules! test_uint {
|
|||||||
let a: $type_ = rand::random();
|
let a: $type_ = rand::random();
|
||||||
let b: $type_ = rand::random();
|
let b: $type_ = rand::random();
|
||||||
|
|
||||||
let bytes = include_bytes!("ternary.leo");
|
let bytes = include_str!("ternary.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
// true -> field 1
|
// true -> field 1
|
||||||
|
@ -64,11 +64,10 @@ fn new_compiler() -> EdwardsTestCompiler {
|
|||||||
EdwardsTestCompiler::new(program_name, path, output_dir)
|
EdwardsTestCompiler::new(program_name, path, output_dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn parse_program(bytes: &[u8]) -> Result<EdwardsTestCompiler, CompilerError> {
|
pub(crate) fn parse_program(program_string: &str) -> Result<EdwardsTestCompiler, CompilerError> {
|
||||||
let mut compiler = new_compiler();
|
let mut compiler = new_compiler();
|
||||||
let program_string = String::from_utf8_lossy(bytes);
|
|
||||||
|
|
||||||
compiler.parse_program_from_string(&program_string)?;
|
compiler.parse_program_from_string(program_string)?;
|
||||||
|
|
||||||
Ok(compiler)
|
Ok(compiler)
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ use leo_ast::InputValue;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_let() {
|
fn test_let() {
|
||||||
let bytes = include_bytes!("let.leo");
|
let bytes = include_str!("let.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -27,7 +27,7 @@ fn test_let() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_let_mut() {
|
fn test_let_mut() {
|
||||||
let bytes = include_bytes!("let_mut.leo");
|
let bytes = include_str!("let_mut.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -35,7 +35,7 @@ fn test_let_mut() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_const_fail() {
|
fn test_const_fail() {
|
||||||
let bytes = include_bytes!("const.leo");
|
let bytes = include_str!("const.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -43,7 +43,7 @@ fn test_const_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_const_mut_fail() {
|
fn test_const_mut_fail() {
|
||||||
let bytes = include_bytes!("const_mut.leo");
|
let bytes = include_str!("const_mut.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -51,7 +51,7 @@ fn test_const_mut_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_array() {
|
fn test_array() {
|
||||||
let bytes = include_bytes!("array.leo");
|
let bytes = include_str!("array.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -59,7 +59,7 @@ fn test_array() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_array_mut() {
|
fn test_array_mut() {
|
||||||
let bytes = include_bytes!("array_mut.leo");
|
let bytes = include_str!("array_mut.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -67,7 +67,7 @@ fn test_array_mut() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_circuit() {
|
fn test_circuit() {
|
||||||
let bytes = include_bytes!("circuit.leo");
|
let bytes = include_str!("circuit.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -75,7 +75,7 @@ fn test_circuit() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_circuit_mut() {
|
fn test_circuit_mut() {
|
||||||
let bytes = include_bytes!("circuit_mut.leo");
|
let bytes = include_str!("circuit_mut.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
expect_compiler_error(program);
|
expect_compiler_error(program);
|
||||||
@ -83,7 +83,7 @@ fn test_circuit_mut() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_circuit_variable_mut() {
|
fn test_circuit_variable_mut() {
|
||||||
let bytes = include_bytes!("circuit_variable_mut.leo");
|
let bytes = include_str!("circuit_variable_mut.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -91,7 +91,7 @@ fn test_circuit_variable_mut() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_circuit_function_mut() {
|
fn test_circuit_function_mut() {
|
||||||
let bytes = include_bytes!("circuit_function_mut.leo");
|
let bytes = include_str!("circuit_function_mut.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -99,7 +99,7 @@ fn test_circuit_function_mut() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_circuit_static_function_mut() {
|
fn test_circuit_static_function_mut() {
|
||||||
let bytes = include_bytes!("circuit_static_function_mut.leo");
|
let bytes = include_str!("circuit_static_function_mut.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
@ -107,7 +107,7 @@ fn test_circuit_static_function_mut() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_function_input() {
|
fn test_function_input() {
|
||||||
let bytes = include_bytes!("function_input.leo");
|
let bytes = include_str!("function_input.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
||||||
@ -119,7 +119,7 @@ fn test_function_input() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_function_input_mut() {
|
fn test_function_input_mut() {
|
||||||
let bytes = include_bytes!("function_input_mut.leo");
|
let bytes = include_str!("function_input_mut.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
|
||||||
|
@ -28,7 +28,7 @@ use leo_ast::InputValue;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_assert() {
|
fn test_assert() {
|
||||||
let bytes = include_bytes!("assert.leo");
|
let bytes = include_str!("assert.leo");
|
||||||
let mut program_1_pass = parse_program(bytes).unwrap();
|
let mut program_1_pass = parse_program(bytes).unwrap();
|
||||||
let mut program_0_pass = program_1_pass.clone();
|
let mut program_0_pass = program_1_pass.clone();
|
||||||
let mut program_2_fail = program_1_pass.clone();
|
let mut program_2_fail = program_1_pass.clone();
|
||||||
@ -60,7 +60,7 @@ fn test_assert() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutate() {
|
fn test_mutate() {
|
||||||
let bytes = include_bytes!("mutate.leo");
|
let bytes = include_str!("mutate.leo");
|
||||||
let mut program_1_pass = parse_program(bytes).unwrap();
|
let mut program_1_pass = parse_program(bytes).unwrap();
|
||||||
let mut program_0_pass = program_1_pass.clone();
|
let mut program_0_pass = program_1_pass.clone();
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ fn test_mutate() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_for_loop() {
|
fn test_for_loop() {
|
||||||
let bytes = include_bytes!("for_loop.leo");
|
let bytes = include_str!("for_loop.leo");
|
||||||
let mut program_true_6 = parse_program(bytes).unwrap();
|
let mut program_true_6 = parse_program(bytes).unwrap();
|
||||||
let mut program_false_0 = program_true_6.clone();
|
let mut program_false_0 = program_true_6.clone();
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ fn test_for_loop() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chain() {
|
fn test_chain() {
|
||||||
let bytes = include_bytes!("chain.leo");
|
let bytes = include_str!("chain.leo");
|
||||||
let mut program_1_1 = parse_program(bytes).unwrap();
|
let mut program_1_1 = parse_program(bytes).unwrap();
|
||||||
let mut program_2_2 = program_1_1.clone();
|
let mut program_2_2 = program_1_1.clone();
|
||||||
let mut program_4_3 = program_1_1.clone();
|
let mut program_4_3 = program_1_1.clone();
|
||||||
@ -147,7 +147,7 @@ fn test_chain() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nested() {
|
fn test_nested() {
|
||||||
let bytes = include_bytes!("nested.leo");
|
let bytes = include_str!("nested.leo");
|
||||||
let mut program_true_true_3 = parse_program(bytes).unwrap();
|
let mut program_true_true_3 = parse_program(bytes).unwrap();
|
||||||
let mut program_true_false_1 = program_true_true_3.clone();
|
let mut program_true_false_1 = program_true_true_3.clone();
|
||||||
let mut program_false_false_0 = program_true_true_3.clone();
|
let mut program_false_false_0 = program_true_true_3.clone();
|
||||||
|
@ -23,7 +23,7 @@ pub mod conditional;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ternary_basic() {
|
fn test_ternary_basic() {
|
||||||
let bytes = include_bytes!("ternary_basic.leo");
|
let bytes = include_str!("ternary_basic.leo");
|
||||||
let mut program = parse_program(bytes).unwrap();
|
let mut program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let main_input = generate_main_input(vec![
|
let main_input = generate_main_input(vec![
|
||||||
@ -51,7 +51,7 @@ fn test_ternary_basic() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_iteration_basic() {
|
fn test_iteration_basic() {
|
||||||
let bytes = include_bytes!("iteration_basic.leo");
|
let bytes = include_str!("iteration_basic.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
@ -59,7 +59,7 @@ fn test_iteration_basic() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_num_returns_fail() {
|
fn test_num_returns_fail() {
|
||||||
let bytes = include_bytes!("num_returns_fail.leo");
|
let bytes = include_str!("num_returns_fail.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
expect_type_inference_error(error);
|
expect_type_inference_error(error);
|
||||||
|
@ -18,7 +18,7 @@ use crate::parse_program;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_address_name_fail() {
|
fn test_address_name_fail() {
|
||||||
let bytes = include_bytes!("address_fail.leo");
|
let bytes = include_str!("address_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -26,7 +26,7 @@ fn test_address_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_console_name_fail() {
|
fn test_console_name_fail() {
|
||||||
let bytes = include_bytes!("console_fail.leo");
|
let bytes = include_str!("console_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -34,7 +34,7 @@ fn test_console_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_field_name_fail() {
|
fn test_field_name_fail() {
|
||||||
let bytes = include_bytes!("field_fail.leo");
|
let bytes = include_str!("field_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -42,7 +42,7 @@ fn test_field_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_group_name_fail() {
|
fn test_group_name_fail() {
|
||||||
let bytes = include_bytes!("group_fail.leo");
|
let bytes = include_str!("group_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -50,7 +50,7 @@ fn test_group_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_i8_name_fail() {
|
fn test_i8_name_fail() {
|
||||||
let bytes = include_bytes!("i8_fail.leo");
|
let bytes = include_str!("i8_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -58,7 +58,7 @@ fn test_i8_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_input_name_fail() {
|
fn test_input_name_fail() {
|
||||||
let bytes = include_bytes!("input_fail.leo");
|
let bytes = include_str!("input_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -66,7 +66,7 @@ fn test_input_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_type_name_fail() {
|
fn test_self_type_name_fail() {
|
||||||
let bytes = include_bytes!("self_type_fail.leo");
|
let bytes = include_str!("self_type_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -74,7 +74,7 @@ fn test_self_type_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_keyword_name_fail() {
|
fn test_self_keyword_name_fail() {
|
||||||
let bytes = include_bytes!("self_keyword_fail.leo");
|
let bytes = include_str!("self_keyword_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -82,7 +82,7 @@ fn test_self_keyword_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_true_name_fail() {
|
fn test_true_name_fail() {
|
||||||
let bytes = include_bytes!("true_fail.leo");
|
let bytes = include_str!("true_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
@ -90,7 +90,7 @@ fn test_true_name_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_u8_name_fail() {
|
fn test_u8_name_fail() {
|
||||||
let bytes = include_bytes!("u8_fail.leo");
|
let bytes = include_str!("u8_fail.leo");
|
||||||
let syntax_error = parse_program(bytes).is_err();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
assert!(syntax_error);
|
assert!(syntax_error);
|
||||||
|
@ -25,7 +25,7 @@ pub mod identifiers;
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn test_semicolon() {
|
fn test_semicolon() {
|
||||||
let bytes = include_bytes!("semicolon.leo");
|
let bytes = include_str!("semicolon.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
match error {
|
match error {
|
||||||
@ -36,7 +36,7 @@ fn test_semicolon() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_undefined() {
|
fn test_undefined() {
|
||||||
let bytes = include_bytes!("undefined.leo");
|
let bytes = include_str!("undefined.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let program = parse_program(bytes).unwrap();
|
||||||
|
|
||||||
let error = expect_compiler_error(program);
|
let error = expect_compiler_error(program);
|
||||||
@ -76,7 +76,7 @@ fn input_syntax_error() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_compare_mismatched_types() {
|
fn test_compare_mismatched_types() {
|
||||||
let bytes = include_bytes!("compare_mismatched_types.leo");
|
let bytes = include_str!("compare_mismatched_types.leo");
|
||||||
let error = parse_program(bytes).err().unwrap();
|
let error = parse_program(bytes).err().unwrap();
|
||||||
|
|
||||||
// Expect a type inference error.
|
// Expect a type inference error.
|
||||||
|
@ -18,7 +18,7 @@ use crate::{assert_satisfied, parse_program};
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tuple_basic() {
|
fn test_tuple_basic() {
|
||||||
let program_bytes = include_bytes!("basic.leo");
|
let program_bytes = include_str!("basic.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ fn test_tuple_basic() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tuple_access() {
|
fn test_tuple_access() {
|
||||||
let program_bytes = include_bytes!("access.leo");
|
let program_bytes = include_str!("access.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ fn test_tuple_access() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tuple_typed() {
|
fn test_tuple_typed() {
|
||||||
let program_bytes = include_bytes!("typed.leo");
|
let program_bytes = include_str!("typed.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ fn test_tuple_typed() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multiple() {
|
fn test_multiple() {
|
||||||
let program_bytes = include_bytes!("multiple.leo");
|
let program_bytes = include_str!("multiple.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ fn test_multiple() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multiple_typed() {
|
fn test_multiple_typed() {
|
||||||
let program_bytes = include_bytes!("multiple_typed.leo");
|
let program_bytes = include_str!("multiple_typed.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ fn test_multiple_typed() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_function() {
|
fn test_function() {
|
||||||
let program_bytes = include_bytes!("function.leo");
|
let program_bytes = include_str!("function.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ fn test_function() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_function_typed() {
|
fn test_function_typed() {
|
||||||
let program_bytes = include_bytes!("function_typed.leo");
|
let program_bytes = include_str!("function_typed.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ fn test_function_typed() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_function_multiple() {
|
fn test_function_multiple() {
|
||||||
let progam_bytes = include_bytes!("function_multiple.leo");
|
let progam_bytes = include_str!("function_multiple.leo");
|
||||||
|
|
||||||
let program = parse_program(progam_bytes).unwrap();
|
let program = parse_program(progam_bytes).unwrap();
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ fn test_function_multiple() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nested() {
|
fn test_nested() {
|
||||||
let program_bytes = include_bytes!("nested.leo");
|
let program_bytes = include_str!("nested.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ fn test_nested() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nested_access() {
|
fn test_nested_access() {
|
||||||
let program_bytes = include_bytes!("nested_access.leo");
|
let program_bytes = include_str!("nested_access.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ fn test_nested_access() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nested_typed() {
|
fn test_nested_typed() {
|
||||||
let program_bytes = include_bytes!("nested_typed.leo");
|
let program_bytes = include_str!("nested_typed.leo");
|
||||||
|
|
||||||
let program = parse_program(program_bytes).unwrap();
|
let program = parse_program(program_bytes).unwrap();
|
||||||
|
|
||||||
@ -117,6 +117,6 @@ fn test_nested_typed() {
|
|||||||
|
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn test_input() {
|
// fn test_input() {
|
||||||
// let input_bytes = include_bytes!("inputs/input.in");
|
// let input_bytes = include_str!("inputs/input.in");
|
||||||
// let program_bytes = include_bytes!("")
|
// let program_bytes = include_str!("")
|
||||||
// }
|
// }
|
||||||
|
Loading…
Reference in New Issue
Block a user