This commit is contained in:
damirka 2021-05-05 19:31:25 +03:00
parent 925afef17c
commit d5e8fb3718
83 changed files with 346 additions and 242 deletions

View File

@ -36,16 +36,15 @@ pub(crate) fn make_test_context() -> AsgContext<'static> {
new_context(allocator)
}
fn new_compiler() -> EdwardsTestCompiler {
fn new_compiler(path: PathBuf) -> EdwardsTestCompiler {
let program_name = "test".to_string();
let path = PathBuf::from("/test/src/main.leo");
let output_dir = PathBuf::from("/output/");
EdwardsTestCompiler::new(program_name, path, output_dir, make_test_context(), None)
}
pub(crate) fn parse_program(program_string: &str) -> Result<EdwardsTestCompiler, CompilerError> {
let mut compiler = new_compiler();
pub(crate) fn parse_program(program_string: &str, cwd: PathBuf) -> Result<EdwardsTestCompiler, CompilerError> {
let mut compiler = new_compiler(cwd);
compiler.parse_program_from_string(program_string)?;
@ -72,7 +71,21 @@ impl Namespace for CompileNamespace {
}
fn run_test(&self, test: Test) -> Result<Value, String> {
let parsed = parse_program(&test.content).map_err(|x| x.to_string())?;
// Check for CWD option:
// ``` cwd: import ```
// When set, uses different working directory for current file.
// If not, uses file path as current working directory.
let cwd = test
.config
.get("cwd")
.map(|val| {
let mut cwd = test.path.clone();
cwd.pop();
cwd.join(&val.as_str().unwrap())
})
.unwrap_or(test.path.clone());
let parsed = parse_program(&test.content, cwd).map_err(|x| x.to_string())?;
// (name, content)
let mut inputs = vec![];

View File

@ -1,5 +1,12 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
cwd: imports
*/
import test-import.foo as bar;
function main() {
console.assert(bar() == 1u32);
}
function main() -> bool {
return bar() == 1u32;
}

View File

@ -1,5 +1,12 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
cwd: imports
*/
import test-import.foo;
function main() {
console.assert(foo() == 1u32);
}
function main() -> bool {
return foo() == 1u32;
}

View File

@ -0,0 +1,11 @@
// test: ignore
// TODO: add some tag for ignored files
circuit Point {
x: u32
y: u32
}
function foo() -> u32 {
return 1u32;
}

View File

@ -0,0 +1,2 @@
[registers]
r0: bool = true;

View File

@ -1,3 +1,10 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
cwd: imports
*/
import test-import.( // local import
Point,
foo,
@ -11,7 +18,7 @@ import bar.( // imports directory import
import car.Car; // imports directory import
function main() {
function main() -> bool {
const point = Point { x: 1u32, y: 1u32 };
const foo = foo();
@ -22,5 +29,5 @@ function main() {
const car = Car { c: 1u32 };
console.assert(car.c == 1u32);
}
return car.c == 1u32;
}

View File

@ -1,3 +1,10 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
cwd: imports
*/
import test-import.*; // local import
import bar.*; // imports directory import
@ -5,7 +12,7 @@ import bar.baz.*; // imports directory import
import bar.bat.bat.*; // imports directory import
import car.*; // imports directory import
function main() {
function main() -> bool {
const point = Point { x: 1u32, y: 1u32 };
const foo = foo();
@ -15,5 +22,5 @@ function main() {
const car = Car { c: 1u32 };
console.assert(car.c == 1u32);
}
return car.c == 1u32;
}

View File

@ -1,154 +0,0 @@
// Copyright (C) 2019-2021 Aleo Systems Inc.
// This file is part of the Leo library.
// The Leo library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// The Leo library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{assert_satisfied, parse_program};
use std::env::{current_dir, set_current_dir};
static TEST_SOURCE_DIRECTORY: &str = "tests/import";
// Import tests rely on knowledge of local directories. They should be run locally only.
pub fn set_local_dir() {
let mut local = current_dir().unwrap();
local.push(TEST_SOURCE_DIRECTORY);
set_current_dir(local).unwrap();
}
#[test]
#[ignore]
fn test_basic() {
set_local_dir();
let program_string = include_str!("basic.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
#[ignore]
fn test_multiple() {
set_local_dir();
let program_string = include_str!("multiple.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
#[ignore]
fn test_star() {
set_local_dir();
let program_string = include_str!("star.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
#[ignore]
fn test_star_fail() {
set_local_dir();
let program_string = include_str!("star_fail.leo");
assert!(parse_program(program_string).is_err());
}
#[test]
#[ignore]
fn test_alias() {
set_local_dir();
let program_string = include_str!("alias.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
// naming tests
#[test]
#[ignore]
fn test_names_pass() {
set_local_dir();
let program_string = include_str!("names.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
#[ignore]
fn test_names_fail_1() {
set_local_dir();
let program_string = include_str!("names_dash_a.leo");
assert!(parse_program(program_string).is_err());
}
#[test]
#[ignore]
fn test_names_fail_2() {
set_local_dir();
let program_string = include_str!("names_a_dash.leo");
assert!(parse_program(program_string).is_err());
}
#[test]
#[ignore]
fn test_names_fail_3() {
set_local_dir();
let program_string = include_str!("names_underscore.leo");
assert!(parse_program(program_string).is_err());
}
#[test]
#[ignore]
fn test_names_fail_4() {
set_local_dir();
let program_string = include_str!("names_dollar.leo");
assert!(parse_program(program_string).is_err());
}
// more complex tests
#[test]
#[ignore]
fn test_many_import() {
set_local_dir();
let program_string = include_str!("many_import.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
#[ignore]
fn test_many_import_star() {
set_local_dir();
let program_string = include_str!("many_import_star.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}

View File

@ -1,10 +1,17 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
cwd: imports
*/
import test-import.(
Point,
foo
);
function main() {
function main() -> bool {
const a = Point { x: 1u32, y: 0u32 };
console.assert(a.x == 1u32);
}
return a.x == 1u32;
}

View File

@ -1,5 +1,12 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
cwd: imports
*/
import a0-f.foo;
import a-9.bar;
import hello-world.hello;
function main() {}
function main() {}

View File

@ -1,3 +1,12 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
cwd: imports
*/
import a-.foo;
function main() {}
function main() -> bool {
return false;
}

View File

@ -1,3 +1,12 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
cwd: imports
*/
import -a.foo;
function main() {}
function main() -> bool {
return false;
}

View File

@ -1,3 +1,12 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
cwd: imports
*/
import money$.foo;
function main() {}
function main() -> bool {
return false;
}

View File

@ -1,3 +1,12 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
cwd: imports
*/
import hello_world.foo;
function main() {}
function main() -> bool {
return true;
}

View File

@ -1,8 +0,0 @@
circuit Point {
x: u32
y: u32
}
function foo() -> u32 {
return 1u32;
}

View File

@ -1,7 +1,14 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
cwd: imports
*/
import test-import.*;
function main() {
function main() -> bool {
const a = Point { x: 1u32, y: 0u32 };
console.assert(foo() == 1u32);
}
return foo() == 1u32;
}

View File

@ -1,4 +1,11 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
cwd: imports
*/
// importing `*` from a directory is illegal
import bar.bat.*;
function main() {}
function main() {}

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:37\n |\n 4 | console.assert(a == [[0u8; 2]; 3)]); // This should be written the right way as this test is for the input file.\n | ^\n |\n = expected ']' -- got ')'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/input_nested_3x2_fail.leo:4:37\n |\n 4 | console.assert(a == [[0u8; 2]; 3)]); // This should be written the right way as this test is for the input file.\n | ^\n |\n = expected ']' -- got ')'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^\n |\n = illegal assignment to immutable variable 'self'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/const_self_variable_fail.leo:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^\n |\n = illegal assignment to immutable variable 'self'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:9:15\n |\n 9 | const a = Foo { y: 0u32 };\n | ^^^^^^^^^^^^^^^\n |\n = missing circuit member 'x' for initialization of circuit 'Foo'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/inline_fail.leo:9:15\n |\n 9 | const a = Foo { y: 0u32 };\n | ^^^^^^^^^^^^^^^\n |\n = missing circuit member 'x' for initialization of circuit 'Foo'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:9:15\n |\n 9 | const a = Foo { y };\n | ^^^^^^^^^\n |\n = missing circuit member 'x' for initialization of circuit 'Foo'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/inline_member_fail.leo:9:15\n |\n 9 | const a = Foo { y };\n | ^^^^^^^^^\n |\n = missing circuit member 'x' for initialization of circuit 'Foo'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:15\n |\n 4 | const a = Foo { };\n | ^^^\n |\n = failed to resolve circuit: 'Foo'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/inline_undefined.leo:4:15\n |\n 4 | const a = Foo { };\n | ^^^\n |\n = failed to resolve circuit: 'Foo'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:11:17\n |\n 11 | const err = a.echoed(1u32);\n | ^^^^^^^^\n |\n = illegal reference to non-existant member 'echoed' of circuit 'Foo'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/member_function_fail.leo:11:17\n |\n 11 | const err = a.echoed(1u32);\n | ^^^^^^^^\n |\n = illegal reference to non-existant member 'echoed' of circuit 'Foo'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:11:17\n |\n 11 | const err = a.echo(1u32); // echo is a static function and must be accessed using `::`\n | ^^^^^^\n |\n = cannot call static function 'echo' of circuit 'Foo' from target"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/member_function_invalid.leo:11:17\n |\n 11 | const err = a.echo(1u32); // echo is a static function and must be accessed using `::`\n | ^^^^^^\n |\n = cannot call static function 'echo' of circuit 'Foo' from target"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:10:17\n |\n 10 | const err = Foo.echo(1u32); // Invalid, echo is a static function and must be accessed using `::`\n | ^^^\n |\n = failed to resolve variable reference 'Foo'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/member_static_function_invalid.leo:10:17\n |\n 10 | const err = Foo.echo(1u32); // Invalid, echo is a static function and must be accessed using `::`\n | ^^^\n |\n = failed to resolve variable reference 'Foo'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:10:17\n |\n 10 | const err = Foo::echoed(1u32);\n | ^^^^^^^^^^^\n |\n = illegal reference to non-existant member 'echoed' of circuit 'Foo'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/member_static_function_undefined.leo:10:17\n |\n 10 | const err = Foo::echoed(1u32);\n | ^^^^^^^^^^^\n |\n = illegal reference to non-existant member 'echoed' of circuit 'Foo'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:9:17\n |\n 9 | const err = a.y;\n | ^^^\n |\n = illegal reference to non-existant member 'y' of circuit 'Foo'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/member_variable_fail.leo:9:17\n |\n 9 | const err = a.y;\n | ^^^\n |\n = illegal reference to non-existant member 'y' of circuit 'Foo'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:12:5\n |\n 12 | f.bar = 1u8;\n | ^^^^^^^^^^^\n |\n = attempt to assign to function 'bar'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/mut_function_fail.leo:12:5\n |\n 12 | f.bar = 1u8;\n | ^^^^^^^^^^^\n |\n = attempt to assign to function 'bar'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^\n |\n = attempt to assign to function 'bar'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/mut_self_function_fail.leo:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^\n |\n = attempt to assign to function 'bar'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^\n |\n = attempt to assign to function 'bar'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/mut_self_static_function_fail.leo:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^\n |\n = attempt to assign to function 'bar'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^\n |\n = illegal assignment to immutable variable 'self'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/mut_self_variable_fail.leo:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^\n |\n = illegal assignment to immutable variable 'self'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:8:19\n |\n 8 | let f = Foo { a: 0u8 };\n | ^\n |\n = extra circuit member 'a' for initialization of circuit 'Foo' is not allowed"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/mut_static_function_fail.leo:8:19\n |\n 8 | let f = Foo { a: 0u8 };\n | ^\n |\n = extra circuit member 'a' for initialization of circuit 'Foo' is not allowed"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:10:5\n |\n 10 | f.a = 1u8;\n | ^^^^^^^^^\n |\n = illegal assignment to immutable variable 'f'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/mut_variable_fail.leo:10:5\n |\n 10 | f.a = 1u8;\n | ^^^^^^^^^\n |\n = illegal assignment to immutable variable 'f'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:5:5\n |\n 5 | static function new() -> Self {\n | ^^^^^^\n |\n = expected 'ident', got 'static'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/self_circuit.leo:5:5\n |\n 5 | static function new() -> Self {\n | ^^^^^^\n |\n = expected 'ident', got 'static'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:5\n |\n 4 | Self::main();\n | ^^^^\n |\n = failed to resolve circuit: 'Self'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/self_fail.leo:4:5\n |\n 4 | Self::main();\n | ^^^^\n |\n = failed to resolve circuit: 'Self'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:13:17\n |\n 13 | const err = foo.bar();\n | ^^^^^^^\n |\n = cannot call static function 'bar' of circuit 'Foo' from target"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/self_member_invalid.leo:13:17\n |\n 13 | const err = foo.bar();\n | ^^^^^^^\n |\n = cannot call static function 'bar' of circuit 'Foo' from target"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:11:17\n |\n 11 | const err = foo.bar();\n | ^^^^^^^\n |\n = cannot call static function 'bar' of circuit 'Foo' from target"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/circuits/self_member_undefined.leo:11:17\n |\n 11 | const err = foo.bar();\n | ^^^^^^^\n |\n = cannot call static function 'bar' of circuit 'Foo' from target"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:18\n |\n 4 | console.log( hello );\n | ^^^^^\n |\n = expected 'formatted string', got 'hello'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/console/log_fail.leo:4:18\n |\n 4 | console.log( hello );\n | ^^^^^\n |\n = expected 'formatted string', got 'hello'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:17\n |\n 4 | console.log(\"{}\");\n | ^^^^\n |\n = function call expected 2 arguments, got 1"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/console/log_parameter_fail_empty.leo:4:17\n |\n 4 | console.log(\"{}\");\n | ^^^^\n |\n = function call expected 2 arguments, got 1"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:17\n |\n 4 | console.log(\"\", 1u32);\n | ^^^^^^^^\n |\n = function call expected 1 arguments, got 2"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/console/log_parameter_fail_none.leo:4:17\n |\n 4 | console.log(\"\", 1u32);\n | ^^^^^^^^\n |\n = function call expected 1 arguments, got 2"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:23\n |\n 4 | console.log(\"{}\", a);\n | ^\n |\n = failed to resolve variable reference 'a'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/console/log_parameter_fail_unknown.leo:4:23\n |\n 4 | console.log(\"{}\", a);\n | ^\n |\n = failed to resolve variable reference 'a'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:30\n |\n 3 | import core.unstable.blake2s.BadCircuit; // `BadCircuit` is not included in the blake2s package\n | ^^^^^^^^^^\n |\n = failed to resolve import: 'core.unstable.blake2s.BadCircuit'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/core/blake2s.leo:3:30\n |\n 3 | import core.unstable.blake2s.BadCircuit; // `BadCircuit` is not included in the blake2s package\n | ^^^^^^^^^^\n |\n = failed to resolve import: 'core.unstable.blake2s.BadCircuit'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:30\n |\n 3 | import core.unstable.blake2s.BadCircuit; // `BadCircuit` is not included in the blake2s package\n | ^^^^^^^^^^\n |\n = failed to resolve import: 'core.unstable.blake2s.BadCircuit'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/core/core_circuit_invalid.leo:3:30\n |\n 3 | import core.unstable.blake2s.BadCircuit; // `BadCircuit` is not included in the blake2s package\n | ^^^^^^^^^^\n |\n = failed to resolve import: 'core.unstable.blake2s.BadCircuit'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:8:1\n |\n 8 | function main() {\n 9 | ...\n 10 | }\n | ^\n |\n = a function named \"main\" already exists in this scope"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/function/duplicate_definition_fail.leo:8:1\n |\n 8 | function main() {\n 9 | ...\n 10 | }\n | ^\n |\n = a function named \"main\" already exists in this scope"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:5\n |\n 4 | if true {\n 5 | ...\n 6 | }\n | ^\n |\n = function 'main' failed to validate return path: 'cannot have asymmetrical return in if statement'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/function/multiple_returns_fail.leo:4:5\n |\n 4 | if true {\n 5 | ...\n 6 | }\n | ^\n |\n = function 'main' failed to validate return path: 'cannot have asymmetrical return in if statement'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:1\n |\n 3 | function main() -> bool {\n 4 | ...\n 5 | }\n 6 | \n 7 | \n 8 | \n 9 | \n 10 | \n | ^\n |\n = function 'main' missing return for all paths"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/function/multiple_returns_fail_conditional.leo:3:1\n |\n 3 | function main() -> bool {\n 4 | ...\n 5 | }\n 6 | \n 7 | \n 8 | \n 9 | \n 10 | \n | ^\n |\n = function 'main' missing return for all paths"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:12\n |\n 4 | return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]`\n | ^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/function/return_array_nested_fail.leo:4:12\n |\n 4 | return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]`\n | ^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:12\n |\n 4 | return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]`\n | ^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/function/return_array_tuple_fail.leo:4:12\n |\n 4 | return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]`\n | ^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:5:12\n |\n 5 | return myGlobal;\n | ^^^^^^^^\n |\n = failed to resolve variable reference 'myGlobal'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/function/scope_fail.leo:5:12\n |\n 5 | return myGlobal;\n | ^^^^^^^^\n |\n = failed to resolve variable reference 'myGlobal'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:5:5\n |\n 5 | my_function();\n | ^^^^^^^^^^^\n |\n = failed to resolve function: 'my_function'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/function/undefined.leo:5:5\n |\n 5 | my_function();\n | ^^^^^^^^^^^\n |\n = failed to resolve function: 'my_function'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,15 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/dummy.in
output:
registers: {}

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/import/imports:3:10\n |\n 3 | import a-.foo;\n | ^\n |\n = expected 'ident', got '.'"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/import/imports:3:8\n |\n 3 | import -a.foo;\n | ^\n |\n = expected 'ident', got '-'"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/import/imports:3:13\n |\n 3 | import money$.foo;\n | ^\n |\n = unexpected token: '$'"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/import/imports:3:20\n |\n 3 | import hello_world.foo;\n | ^^^\n |\n = Cannot find imported package `hello_world` in source files or import directory."

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/import/imports:4:16\n |\n 4 | import bar.bat.*;\n | ^\n |\n = Expected library file `\"/Users/dam/projects/aleo/leo/test-framework/../tests/compiler/import/imports/bar/src/bat/src/lib.leo\"`."

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:1\n |\n 3 | function main(x: [i16; 2]) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input array dimensions mismatch expected 1, found array dimensions 2"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/input_files/program_input/main_array_fail.leo:3:1\n |\n 3 | function main(x: [i16; 2]) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input array dimensions mismatch expected 1, found array dimensions 2"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:1\n |\n 3 | function main(x: (u8, bool, u8)) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input tuple size mismatch expected 3, found tuple with length 2"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/input_files/program_input/main_tuple_fail.leo:3:1\n |\n 3 | function main(x: (u8, bool, u8)) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input tuple size mismatch expected 3, found tuple with length 2"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:1\n |\n 3 | function main(const x: [i16; 2]) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input array dimensions mismatch expected 2, found array dimensions 1"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/input_files/program_input_constants/main_array_fail.leo:3:1\n |\n 3 | function main(const x: [i16; 2]) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input array dimensions mismatch expected 2, found array dimensions 1"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:1\n |\n 3 | function main(const x: (u8, bool, u8)) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input tuple size mismatch expected 3, found tuple with length 2"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/input_files/program_input_constants/main_tuple_fail.leo:3:1\n |\n 3 | function main(const x: (u8, bool, u8)) {\n 4 | ...\n 5 | }\n | ^\n |\n = Input tuple size mismatch expected 3, found tuple with length 2"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:3:1\n |\n 3 | function main() -> bool {\n 4 | ...\n 5 | }\n | ^\n |\n = Mismatched types. Expected register output type `u8`, found type `bool`."
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/input_files/program_registers/registers_fail.leo:3:1\n |\n 3 | function main() -> bool {\n 4 | ...\n 5 | }\n | ^\n |\n = Mismatched types. Expected register output type `u8`, found type `bool`."

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:20\n |\n 4 | const a: i16 = 32768;\n | ^^^^^\n |\n = failed to parse int value '32768'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/integers/i16/max_fail.leo:4:20\n |\n 4 | const a: i16 = 32768;\n | ^^^^^\n |\n = failed to parse int value '32768'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:20\n |\n 4 | const a: i16 = -32769;\n | ^^^^^^\n |\n = failed to parse int value '-32769'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/integers/i16/min_fail.leo:4:20\n |\n 4 | const a: i16 = -32769;\n | ^^^^^^\n |\n = failed to parse int value '-32769'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:19\n |\n 4 | const a: i8 = 128;\n | ^^^\n |\n = failed to parse int value '128'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/integers/i8/max_fail.leo:4:19\n |\n 4 | const a: i8 = 128;\n | ^^^\n |\n = failed to parse int value '128'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:19\n |\n 4 | const a: i8 = -129;\n | ^^^^\n |\n = failed to parse int value '-129'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/integers/i8/min_fail.leo:4:19\n |\n 4 | const a: i8 = -129;\n | ^^^^\n |\n = failed to parse int value '-129'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:5:15\n |\n 5 | const b = -a;\n | ^^\n |\n = integer operation failed due to the signed integer error `Overflow`"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/integers/i8/negate_min.leo:5:15\n |\n 5 | const b = -a;\n | ^^\n |\n = integer operation failed due to the signed integer error `Overflow`"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:4:13\n |\n 4 | const i = 1 i8;\n | ^\n |\n = Unexpected white space between terms 1 and i8"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/integers/i8/no_space_between_literal.leo:4:13\n |\n 4 | const i = 1 i8;\n | ^\n |\n = Unexpected white space between terms 1 and i8"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:5:5\n |\n 5 | a[0] = 0;\n | ^^^^^^^^\n |\n = illegal assignment to immutable variable 'a'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/mutability/array_fail.leo:5:5\n |\n 5 | a[0] = 0;\n | ^^^^^^^^\n |\n = illegal assignment to immutable variable 'a'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:10:5\n |\n 10 | a.x = 0;\n | ^^^^^^^\n |\n = illegal assignment to immutable variable 'a'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/mutability/circuit_fail.leo:10:5\n |\n 10 | a.x = 0;\n | ^^^^^^^\n |\n = illegal assignment to immutable variable 'a'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:15:5\n |\n 15 | a.foo();\n | ^^^^^\n |\n = cannot call mutable member function 'foo' of circuit 'Foo' from immutable context"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/mutability/circuit_function_const.leo:15:5\n |\n 15 | a.foo();\n | ^^^^^\n |\n = cannot call mutable member function 'foo' of circuit 'Foo' from immutable context"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:8:19\n |\n 8 | let a = Foo { x: 1 };\n | ^\n |\n = extra circuit member 'x' for initialization of circuit 'Foo' is not allowed"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/mutability/circuit_static_function_mut_fail.leo:8:19\n |\n 8 | let a = Foo { x: 1 };\n | ^\n |\n = extra circuit member 'x' for initialization of circuit 'Foo' is not allowed"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:6:5\n |\n 6 | a = 0;\n | ^^^^^\n |\n = illegal assignment to immutable variable 'a'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/mutability/const.leo:6:5\n |\n 6 | a = 0;\n | ^^^^^\n |\n = illegal assignment to immutable variable 'a'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:5:5\n |\n 5 | a = false;\n | ^\n |\n = failed to resolve variable reference 'a'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/mutability/function_input.leo:5:5\n |\n 5 | a = false;\n | ^\n |\n = failed to resolve variable reference 'a'"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:6:5\n |\n 6 | a = 0;\n | ^^^^^\n |\n = illegal assignment to immutable variable 'a'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/mutability/let.leo:6:5\n |\n 6 | a = 0;\n | ^^^^^\n |\n = illegal assignment to immutable variable 'a'"