This commit is contained in:
damirka 2021-05-05 18:29:44 +03:00
parent 032341089b
commit 925afef17c
84 changed files with 627 additions and 358 deletions

View File

@ -1,6 +1,11 @@
/*
namespace: Compile
expectation: Pass
*/
function foo(a: [u8; 1]) {}
function main() {
const a: [u16; 1] = [1; 1];
const a: [u8; 1] = [1; 1];
foo(a);
}
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Pass
*/
function do_nothing(arr: [u32; 2]) {}
function main() {
@ -6,4 +11,4 @@ function main() {
do_nothing(arr);
do_nothing([...arr]);
do_nothing(arr[0u32..]);
}
}

View File

@ -1,7 +1,13 @@
function main(x: u8) -> u8 {
if x == 2u8 {
return 3u8;
/*
namespace: Compile
expectation: Pass
input_file: input/integers.in
*/
function main(a: u32) -> u32 {
if a == 2u32 {
return 3u32;
} else {
return 4u8;
return 4u32;
}
}
}

View File

@ -1,7 +1,13 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
console.log("{}", 1u8);
}
function main() {
console.log("{}", 2u8);
}
}

View File

@ -1,5 +1,10 @@
/*
namespace: Compile
expectation: Pass
*/
function empty() { }
function main() {
empty();
}
}

View File

@ -1,5 +0,0 @@
[main]
x: u8 = 1u8;
[registers]
x: u8 = 0;

View File

@ -0,0 +1,7 @@
[main]
a: u32 = 10;
b: u32 = 100;
[registers]
r0: bool = true;
r1: bool = true;

View File

@ -1,3 +0,0 @@
[registers]
a: bool = true;
b: bool = false;

View File

@ -1,13 +1,19 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function one() -> u32 {
return 1u32;
}
function main() {
function main() -> bool {
let a = 0u32;
for i in 0..10 {
a += one();
}
console.assert(a == 10u32);
}
return a == 10u32;
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function iteration() -> u32 {
let a = 0u32;
@ -8,8 +14,8 @@ function iteration() -> u32 {
return a;
}
function main() {
function main() -> bool {
const total = iteration() + iteration();
console.assert(total == 20);
}
return total == 20;
}

View File

@ -1,221 +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, expect_asg_error, get_output, parse_program, parse_program_with_input};
#[test]
fn test_conditional_return() {
let input_string = include_str!("input/conditional_return.in");
let program_string = include_str!("conditional_return.leo");
let program = parse_program_with_input(program_string, input_string).unwrap();
let expected_string = include_str!("output/conditional_return.out");
let actual_bytes = get_output(program);
let actual_string = std::str::from_utf8(actual_bytes.bytes().as_slice()).unwrap();
assert_eq!(expected_string, actual_string);
}
#[test]
fn test_empty() {
let program_string = include_str!("empty.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_iteration() {
let program_string = include_str!("iteration.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_iteration_repeated() {
let program_string = include_str!("iteration_repeated.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_newlines() {
let input_string = include_str!("input/newlines.in");
let program_string = include_str!("newlines.leo");
let program = parse_program_with_input(program_string, input_string).unwrap();
let expected_string = include_str!("output/newlines.out");
let actual_bytes = get_output(program);
let actual_string = std::str::from_utf8(actual_bytes.bytes().as_slice()).unwrap();
assert_eq!(expected_string, actual_string);
}
#[test]
fn test_multiple_returns() {
let program_string = include_str!("multiple_returns.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_multiple_returns_fail() {
let program_string = include_str!("multiple_returns_fail.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}
#[test]
fn test_multiple_returns_fail_conditional() {
let program_string = include_str!("multiple_returns_fail_conditional.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}
#[test]
fn test_multiple_returns_main() {
let program_string = include_str!("multiple_returns_main.leo");
let input_string = include_str!("input/registers.in");
let program = parse_program_with_input(program_string, input_string).unwrap();
let expected_string = include_str!("output/registers.out");
let actual_bytes = get_output(program);
let actual_string = std::str::from_utf8(actual_bytes.bytes().as_slice()).unwrap();
assert_eq!(expected_string, actual_string);
}
#[test]
fn test_repeated_function_call() {
let program_string = include_str!("repeated.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_return() {
let program_string = include_str!("return.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_scope_fail() {
let program_string = include_str!("scope_fail.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}
#[test]
fn test_undefined() {
let program_string = include_str!("undefined.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}
#[test]
fn test_value_unchanged() {
let program_string = include_str!("value_unchanged.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_array_input() {
let program_string = include_str!("array_input.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error)
}
// Test return multidimensional arrays
#[test]
fn test_return_array_nested_fail() {
let program_string = include_str!("return_array_nested_fail.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}
#[test]
fn test_return_array_nested_pass() {
let program_string = include_str!("return_array_nested_pass.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_return_array_tuple_fail() {
let program_string = include_str!("return_array_tuple_fail.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}
#[test]
fn test_return_array_tuple_pass() {
let program_string = include_str!("return_array_tuple_pass.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
// Test return tuples
#[test]
fn test_return_tuple() {
let program_string = include_str!("return_tuple.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_return_tuple_conditional() {
let program_string = include_str!("return_tuple_conditional.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_array_params_direct_call() {
let program_string = include_str!("array_params_direct_call.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
}
#[test]
fn test_duplicate_function_definition() {
let program_string = include_str!("duplicate_definition.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}

View File

@ -1,10 +1,15 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function tuple() -> (bool, bool) {
return (true, false);
}
function main() {
function main() -> bool {
const (a, b) = tuple();
console.assert(a == true);
console.assert(b == false);
}
return a == true && b == false;
}

View File

@ -1,4 +1,10 @@
function main () -> i8 {
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
function main() -> i8 {
if true {
return 1i8; //ignored
}

View File

@ -1,9 +1,15 @@
function main () -> u16 {
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
function main() -> bool {
if false {
const a = 1u16;
const b = a + 1u16;
return b;
return b == 2u16;
} else if false {
return 0u16;
return true;
}
}
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main() -> (bool, bool) {
return (input.registers.a, input.registers.b);
return (input.registers.r0, input.registers.r1);
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Pass
input_file: input/integers.in
*/
function main(
a: u32,
b: u32,
@ -6,4 +12,4 @@ function main(
u32,
) {
return (a, b);
}
}

View File

@ -1,2 +0,0 @@
[registers]
x: u8 = 4;

View File

@ -1,3 +0,0 @@
[registers]
a: u32 = 0;
b: u32 = 0;

View File

@ -1,3 +0,0 @@
[registers]
a: bool = true;
b: bool = false;

View File

@ -1,9 +1,15 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function one() -> bool {
return true;
}
function main() {
function main() -> bool {
const a = one() && one();
console.assert(a == true);
}
return a == true;
}

View File

@ -1,7 +1,13 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function one() -> u32 {
return 1u32;
}
function main() {
console.assert(one() == 1u32);
}
function main() -> bool {
return one() == 1u32;
}

View File

@ -1,7 +1,13 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
function array_3x2_tuple() -> [[u8; 2]; 3] {
return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]`
}
function main() {
const b = array_3x2_tuple();
}
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function array_3x2_nested() -> [[u8; 2]; 3] {
return [[0u8; 2]; 3];
}
@ -9,4 +15,4 @@ function array_3x2_tuple() -> [[u8; 2]; 3] {
function main() {
const a = array_3x2_nested();
const b = array_3x2_tuple();
}
}

View File

@ -1,7 +1,13 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
function array_3x2_nested() -> [u8; (3, 2)] {
return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]`
}
function main() {
const a = array_3x2_nested();
}
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function array_3x2_nested() -> [u8; (3, 2)] {
return [[0u8; 2]; 3];
}
@ -9,4 +15,4 @@ function array_3x2_tuple() -> [u8; (3, 2)] {
function main() {
const a = array_3x2_nested();
const b = array_3x2_tuple();
}
}

View File

@ -1,3 +1,13 @@
/*
namespace: Compile
expectation: Pass
inputs:
- tuple.in: |
[registers]
r0: (u8, u8) = (0, 0);
r1: u32 = 100;
*/
// Returns a tuple of tuples.
function tuples() -> ((u8, u8), u32) {
const a: (u8, u8) = (1, 2);
@ -8,4 +18,4 @@ function tuples() -> ((u8, u8), u32) {
function main() {
const t = tuples();
}
}

View File

@ -1,7 +1,13 @@
/*
namespace: Compile
expectation: Pass
input_file: input/integers.in
*/
// Returns a tuple using a conditional "if" statement.
function tuple_conditional () -> (
i64,
i64
u32,
u32
) {
if true {
return (1, 1);
@ -10,6 +16,6 @@ function tuple_conditional () -> (
}
}
function main() {
const t = tuple_conditional();
}
function main() -> (u32, u32) {
return tuple_conditional();
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Fail
*/
function foo() -> field {
return myGlobal;
}
@ -5,4 +11,6 @@ function foo() -> field {
function main() {
const myGlobal = 42field;
const err = foo();
}
// TODO: update after field comparison is enabled
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
my_function();
}
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
// Functions input in leo are pass-by-value.
//
// Program execution:
@ -11,9 +17,9 @@ function bad_mutate(x: u32) {
x = 0; // <- does not change `a`
}
function main() {
function main() -> bool {
const a = 1u32;
bad_mutate(a);
console.assert(a == 1u32); // <- value `a` is still `1u32`
}
return a == 1u32; // <- value `a` is still `1u32`
}

View File

@ -3,8 +3,7 @@ namespace: Compile
expectation: Fail
*/
// Arrays are immutable by default.
function main() {
const a = [1u32];
a[0] = 0;
}
}

View File

@ -1,11 +1,12 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main() {
function main() -> bool {
let a = [1u32];
a[0] = 0;
console.assert(a[0] == 0u32);
}
return a[0] == 0u32;
}

View File

@ -1,13 +1,14 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main() {
function main() -> bool {
let a = [1u32, 2u32, 3u32];
a[0u32..2u32] = [4u32, 5u32];
console.assert(a[0] == 4u32);
console.assert(a[1] == 5u32);
console.assert(a[2] == 3u32);
}
return a[0] == 4u32
&& a[1] == 5u32
&& a[2] == 3u32;
}

View File

@ -1,12 +1,13 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main() {
function main() -> bool {
let a = [(1u32, 2u32)];
a[0u32].1 = 3u32;
console.assert(a[0u32].0 == 1u32);
console.assert(a[0u32].1 == 3u32);
}
return a[0u32].0 == 1u32
&& a[0u32].1 == 3u32;
}

View File

@ -1,6 +1,7 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
circuit Foo {
@ -12,10 +13,10 @@ circuit Foo {
}
// cannot call mutable member function 'foo' of circuit 'Foo' from immutable context
function main() {
function main() -> bool {
const a = Foo { x: 1 };
a.foo();
console.assert(a.x == 10u32);
}
return a.x == 10u32;
}

View File

@ -1,6 +1,7 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
circuit Foo {
@ -12,10 +13,10 @@ circuit Foo {
}
function main() {
function main() -> bool {
let a = Foo { x: 1 };
a.foo();
console.assert(a.x == 10u32);
}
return a.x == 10u32;
}

View File

@ -10,4 +10,4 @@ circuit Foo {
function main() {
let a = Foo { x: 1 };
a.bar = 0;
}
}

View File

@ -1,6 +1,7 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
circuit Foo {
@ -8,9 +9,9 @@ circuit Foo {
}
// Using let makes a circuit variable mutable.
function main() {
function main() -> bool{
let a = Foo { x: 1 };
a.x = 0;
console.assert(a.x == 0u32);
}
return a.x == 0u32;
}

View File

@ -1,12 +1,15 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main () {
function main() -> bool {
let x = 100i8;
if false {
x = 1i8;
x *= 100i8;
}
}
return x == 100i8;
}

View File

@ -1,13 +1,10 @@
/*
namespace: Compile
expectation: Fail
inputs:
- const.in: |
[constants]
a: bool = true;
input_file: input/dummy.in
*/
// Const function input are immutable.
function main(const a: bool) {
function main(const b: bool) {
a = false;
}
}

View File

@ -1,15 +1,12 @@
/*
namespace: Compile
expectation: Pass
inputs:
- mut.in: |
[main]
a: bool = false;
input_file: input/dummy.in
*/
// Function input are mutable by default.
function main(a: bool) {
function main(a: bool) -> bool {
a = true;
console.assert(a == true);
}
return a == true;
}

View File

@ -0,0 +1,9 @@
[main]
a: bool = true;
arr: [u32; 2] = [10, 8];
[constants]
b: bool = true;
[registers]
r0: bool = true;

View File

@ -1,12 +1,13 @@
/*
namespace: Compile
expectation: Fail
expectation: Pass
input_file: input/dummy.in
*/
// Adding the `mut` keyword makes a variable mutable.
function main() {
function main() -> bool {
let a = 1u32;
a = 0;
return a == 0u32;
}
}

View File

@ -1,10 +1,12 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main () {
function main() -> bool {
let x = 2u8;
let y = x;
const z = y / 2u8;
}
return z == 1;
}

View File

@ -1,13 +1,7 @@
/*
namespace: Compile
expectation: Pass
inputs:
- swap.in: |
[main]
arr: [u32; 2] = [10, 8];
[registers]
r0: bool = false;
input_file: input/dummy.in
*/
// Swap two elements of an array.
@ -24,4 +18,4 @@ function main(arr: [u32; 2]) -> bool {
// Do swap.
return expected[0] == actual[0] && expected[1] == actual[1];
}
}

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: empty
output:
registers: {}

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: empty
output:
registers: {}

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 95
num_constraints: 127
at: 2cbb45563950440ec6b2ad12e378f1df49d6a12d4e773f0aa898f65f4eb109ff
bt: 7e12153373f45abf58e3b2954d1f1abfc951c7c1203e9e6c96fc37d9d25d8442
ct: 50977b6cd45450d9fddf5934d9167f889165f6ff117b03bb780bd6d89434daf4
output:
- input_file: input/integers.in
output:
registers:
a:
type: u32
value: "4"

View File

@ -0,0 +1,5 @@
---
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"

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: empty
output:
registers: {}

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,5 @@
---
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'"

View File

@ -0,0 +1,5 @@
---
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"

View File

@ -0,0 +1,21 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 2
num_constraints: 2
at: 401937c524c61a28b4fab76d7a1f85bb628850012af62362a0922610372faf92
bt: cdf9a9cee4f2edf55111a95ae60bde9801080f6bde638a5c79273a39a2f9f7f5
ct: 643d5437104296e21d906ecb15b2c96ad278f20cfc4af53b12bb6069bd853726
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"
r1:
type: bool
value: "true"

View File

@ -0,0 +1,21 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 64
num_constraints: 64
at: 2517dbbd3bc6f74f73a279bfe223141cdef8fce801edcc2972d568a815e43bcd
bt: 3a136bbbffaef5f4563e06a03444cfe5c512767d8c88a8be5b39034e18fe0081
ct: 60e36dc4bc844fe8285371cf70c955b79990f094bc50b3401dcac4cbede63e8d
output:
- input_file: input/integers.in
output:
registers:
a:
type: u32
value: "0"
b:
type: u32
value: "0"

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,5 @@
---
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'"

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:
- " --> /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'"

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,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: tuple.in
output:
registers: {}

View File

@ -0,0 +1,21 @@
---
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/integers.in
output:
registers:
a:
type: u32
value: "1"
b:
type: u32
value: "1"

View File

@ -0,0 +1,5 @@
---
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'"

View File

@ -0,0 +1,5 @@
---
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'"

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

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /test/src/main.leo:6:5\n |\n 6 | a[0] = 0;\n | ^^^^^^^^\n |\n = illegal assignment to immutable variable 'a'"
- " --> /test/src/main.leo:5:5\n |\n 5 | a[0] = 0;\n | ^^^^^^^^\n |\n = illegal assignment to immutable variable 'a'"

View File

@ -10,6 +10,9 @@ outputs:
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: empty
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

View File

@ -10,6 +10,9 @@ outputs:
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: empty
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

View File

@ -10,6 +10,9 @@ outputs:
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: empty
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

View File

@ -10,6 +10,9 @@ outputs:
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: empty
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

View File

@ -10,6 +10,9 @@ outputs:
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: empty
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

View File

@ -10,6 +10,9 @@ outputs:
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: empty
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

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 = illegal assignment to immutable variable 'a'"
- " --> /test/src/main.leo:5:5\n |\n 5 | a = false;\n | ^\n |\n = failed to resolve variable reference 'a'"

View File

@ -10,6 +10,9 @@ outputs:
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: mut.in
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

View File

@ -1,5 +1,18 @@
---
namespace: Compile
expectation: Fail
expectation: Pass
outputs:
- " --> /test/src/main.leo:8:12\n |\n 8 | return a == 0u32;\n | ^^^^^^^^^\n |\n = unexpected type, expected: '()', received: 'bool'"
- 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

@ -10,6 +10,9 @@ outputs:
bt: 3402e051d99a4c5be395811da2585d8a57577a0e8307aff01ddfe38b238e03ec
ct: d5dcfd364897254307770e70351a0fba77b2db59351d48fedfaa02aff5307e50
output:
- input_file: empty
- input_file: input/dummy.in
output:
registers: {}
registers:
r0:
type: bool
value: "true"

View File

@ -10,7 +10,7 @@ outputs:
bt: 16d04f802c27d778734e07a0126cae3f096bc4e2e0b4362fe5687a338f1dece5
ct: acfbc6fdb7a3696d43be3cd62939a9731cb8b11c215564c52b3c67343cbda41f
output:
- input_file: swap.in
- input_file: input/dummy.in
output:
registers:
r0: