diff --git a/tests/compiler/array/input/count_to_6.in b/tests/compiler/array/input/count_to_6.in index 64ae8f82f6..21ce3837d0 100644 --- a/tests/compiler/array/input/count_to_6.in +++ b/tests/compiler/array/input/count_to_6.in @@ -2,4 +2,4 @@ a: [[u8; 2]; 3] = [[1, 2], [3, 4], [5, 6]]; [registers] -x: bool = false; \ No newline at end of file +x: bool = false; diff --git a/tests/compiler/array/input/dummy.in b/tests/compiler/array/input/dummy.in new file mode 100644 index 0000000000..6e43b49ecc --- /dev/null +++ b/tests/compiler/array/input/dummy.in @@ -0,0 +1,6 @@ +[main] +y: bool = true; +n: bool = false; + +[registers] +r0: bool = false; diff --git a/tests/compiler/array/input/initializer_fail.in b/tests/compiler/array/input/initializer_fail.in index 0ff699aa13..822f21634b 100644 --- a/tests/compiler/array/input/initializer_fail.in +++ b/tests/compiler/array/input/initializer_fail.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [0u8; (2, 2)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/input_nested_3x2.in b/tests/compiler/array/input/input_nested_3x2.in index 9eaafe9bdd..fbe64e3a1d 100644 --- a/tests/compiler/array/input/input_nested_3x2.in +++ b/tests/compiler/array/input/input_nested_3x2.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [[0u8; 2]; 3]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/input_nested_3x2_fail.in b/tests/compiler/array/input/input_nested_3x2_fail.in index d1c114a08b..aac88582f7 100644 --- a/tests/compiler/array/input/input_nested_3x2_fail.in +++ b/tests/compiler/array/input/input_nested_3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [[0u8; 3]; 2)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/input_tuple_3x2.in b/tests/compiler/array/input/input_tuple_3x2.in index 1c0bd495ec..718fcaa89e 100644 --- a/tests/compiler/array/input/input_tuple_3x2.in +++ b/tests/compiler/array/input/input_tuple_3x2.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [0u8; (3, 2)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/input_tuple_3x2_fail.in b/tests/compiler/array/input/input_tuple_3x2_fail.in index c281d9d464..eb5a8962bf 100644 --- a/tests/compiler/array/input/input_tuple_3x2_fail.in +++ b/tests/compiler/array/input/input_tuple_3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [0u8; (2, 3)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/registers_ones.in b/tests/compiler/array/input/registers_ones.in index fab79f69a0..7320577a6c 100644 --- a/tests/compiler/array/input/registers_ones.in +++ b/tests/compiler/array/input/registers_ones.in @@ -1,2 +1,8 @@ +[main] +a: [u8; 3] = [1, 1, 1]; + [registers] r: [u8; 3] = [1u8, 1u8, 1u8]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/registers_zeros.in b/tests/compiler/array/input/registers_zeros.in index e9aa65cf9b..c24270c956 100644 --- a/tests/compiler/array/input/registers_zeros.in +++ b/tests/compiler/array/input/registers_zeros.in @@ -1,2 +1,8 @@ +[main] +a: [u8; 3] = [1, 1, 1]; // doesn't match arr below + [registers] r: [u8; 3] = [0u8, 0u8, 0u8]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/three_ones.in b/tests/compiler/array/input/three_ones.in index 80d095f864..c6b803e634 100644 --- a/tests/compiler/array/input/three_ones.in +++ b/tests/compiler/array/input/three_ones.in @@ -1,2 +1,5 @@ [main] -a: [u8; 3] = [1, 1, 1]; \ No newline at end of file +a: [u8; 3] = [1, 1, 1]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_nested_3x2.in b/tests/compiler/array/input/type_nested_value_nested_3x2.in index 21fc9b953f..cf532b3dde 100644 --- a/tests/compiler/array/input/type_nested_value_nested_3x2.in +++ b/tests/compiler/array/input/type_nested_value_nested_3x2.in @@ -1,2 +1,5 @@ [main] a: [[u8; 2]; 3] = [[0; 2]; 3]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_nested_3x2_fail.in b/tests/compiler/array/input/type_nested_value_nested_3x2_fail.in index 280b38b909..13ae01334a 100644 --- a/tests/compiler/array/input/type_nested_value_nested_3x2_fail.in +++ b/tests/compiler/array/input/type_nested_value_nested_3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_nested_4x3x2.in b/tests/compiler/array/input/type_nested_value_nested_4x3x2.in index 53ca13b024..2f3f390024 100644 --- a/tests/compiler/array/input/type_nested_value_nested_4x3x2.in +++ b/tests/compiler/array/input/type_nested_value_nested_4x3x2.in @@ -1,2 +1,5 @@ [main] a: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_nested_4x3x2_fail.in b/tests/compiler/array/input/type_nested_value_nested_4x3x2_fail.in index 11f44a76a4..c94c4f6522 100644 --- a/tests/compiler/array/input/type_nested_value_nested_4x3x2_fail.in +++ b/tests/compiler/array/input/type_nested_value_nested_4x3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_tuple_3x2.in b/tests/compiler/array/input/type_nested_value_tuple_3x2.in index 689e164b73..03eed3b54f 100644 --- a/tests/compiler/array/input/type_nested_value_tuple_3x2.in +++ b/tests/compiler/array/input/type_nested_value_tuple_3x2.in @@ -1,2 +1,5 @@ [main] a: [[u8; 2]; 3] = [0; (3, 2)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_tuple_3x2_fail.in b/tests/compiler/array/input/type_nested_value_tuple_3x2_fail.in index 4a43d7d816..93f080d5bf 100644 --- a/tests/compiler/array/input/type_nested_value_tuple_3x2_fail.in +++ b/tests/compiler/array/input/type_nested_value_tuple_3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_tuple_4x3x2.in b/tests/compiler/array/input/type_nested_value_tuple_4x3x2.in index 649a7154ad..dce1923bc6 100644 --- a/tests/compiler/array/input/type_nested_value_tuple_4x3x2.in +++ b/tests/compiler/array/input/type_nested_value_tuple_4x3x2.in @@ -1,2 +1,5 @@ [main] a: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_nested_value_tuple_4x3x2_fail.in b/tests/compiler/array/input/type_nested_value_tuple_4x3x2_fail.in index eed469d6ac..9b69718907 100644 --- a/tests/compiler/array/input/type_nested_value_tuple_4x3x2_fail.in +++ b/tests/compiler/array/input/type_nested_value_tuple_4x3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_nested_3x2.in b/tests/compiler/array/input/type_tuple_value_nested_3x2.in index cb3943365b..30b1b7bcad 100644 --- a/tests/compiler/array/input/type_tuple_value_nested_3x2.in +++ b/tests/compiler/array/input/type_tuple_value_nested_3x2.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [[0; 2]; 3]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_nested_3x2_fail.in b/tests/compiler/array/input/type_tuple_value_nested_3x2_fail.in index c787cbffd9..ede7f5c9f8 100644 --- a/tests/compiler/array/input/type_tuple_value_nested_3x2_fail.in +++ b/tests/compiler/array/input/type_tuple_value_nested_3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_nested_4x3x2.in b/tests/compiler/array/input/type_tuple_value_nested_4x3x2.in index 8105eae543..a03583d029 100644 --- a/tests/compiler/array/input/type_tuple_value_nested_4x3x2.in +++ b/tests/compiler/array/input/type_tuple_value_nested_4x3x2.in @@ -1,2 +1,5 @@ [main] a: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_nested_4x3x2_fail.in b/tests/compiler/array/input/type_tuple_value_nested_4x3x2_fail.in index 3e194e590d..ffb85a2230 100644 --- a/tests/compiler/array/input/type_tuple_value_nested_4x3x2_fail.in +++ b/tests/compiler/array/input/type_tuple_value_nested_4x3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_tuple_3x2.in b/tests/compiler/array/input/type_tuple_value_tuple_3x2.in index cbfeb6d5f1..f5d315cfc7 100644 --- a/tests/compiler/array/input/type_tuple_value_tuple_3x2.in +++ b/tests/compiler/array/input/type_tuple_value_tuple_3x2.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [0; (3, 2)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_tuple_3x2_fail.in b/tests/compiler/array/input/type_tuple_value_tuple_3x2_fail.in index 3409e8aaa9..36001b82ff 100644 --- a/tests/compiler/array/input/type_tuple_value_tuple_3x2_fail.in +++ b/tests/compiler/array/input/type_tuple_value_tuple_3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [u8; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_tuple_4x3x2.in b/tests/compiler/array/input/type_tuple_value_tuple_4x3x2.in index 6fd97ee2d2..0a6975de8e 100644 --- a/tests/compiler/array/input/type_tuple_value_tuple_4x3x2.in +++ b/tests/compiler/array/input/type_tuple_value_tuple_4x3x2.in @@ -1,2 +1,5 @@ [main] a: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input/type_tuple_value_tuple_4x3x2_fail.in b/tests/compiler/array/input/type_tuple_value_tuple_4x3x2_fail.in index d6de4af3c5..9b6a46c114 100644 --- a/tests/compiler/array/input/type_tuple_value_tuple_4x3x2_fail.in +++ b/tests/compiler/array/input/type_tuple_value_tuple_4x3x2_fail.in @@ -1,2 +1,5 @@ [main] a: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering) + +[registers] +x: bool = false; diff --git a/tests/compiler/array/input_nested_3x2.leo b/tests/compiler/array/input_nested_3x2.leo index b7e59a5dc0..0c2d7d8663 100644 --- a/tests/compiler/array/input_nested_3x2.leo +++ b/tests/compiler/array/input_nested_3x2.leo @@ -1,3 +1,9 @@ -function main(a: [u8; (3, 2)]) { - console.assert(a == [[0u8; 2]; 3]); +/* +namespace: Compile +expectation: Pass +input_file: input/input_nested_3x2.in +*/ + +function main(a: [u8; (3, 2)]) -> bool { + return a == [[0u8; 2]; 3]; } diff --git a/tests/compiler/array/input_nested_3x2_fail.leo b/tests/compiler/array/input_nested_3x2_fail.leo index eeb602faa1..ff208f4124 100644 --- a/tests/compiler/array/input_nested_3x2_fail.leo +++ b/tests/compiler/array/input_nested_3x2_fail.leo @@ -1,11 +1,9 @@ /* namespace: Compile expectation: Fail -input_file: - - input/six_zeros.in - - input/count_to_6.in +input_file: input/input_nested_3x2_fail.in */ -function main(a: [u8; (3, 2)]) { - console.assert(a == [[0u8; 2]; 3)]); // This should be written the right way as this test is for the input file. +function main(a: [u8; (3, 2)]) -> bool { + return a == [[0u8; 2]; 3)]; // This should be written the right way as this test is for the input file. } diff --git a/tests/compiler/array/input_tuple_3x2.leo b/tests/compiler/array/input_tuple_3x2.leo index 4c3c001f41..4db78940f6 100644 --- a/tests/compiler/array/input_tuple_3x2.leo +++ b/tests/compiler/array/input_tuple_3x2.leo @@ -1,3 +1,9 @@ -function main(a: [u8; (3, 2)]) { - console.assert(a == [0u8; (3, 2)]); +/* +namespace: Compile +expectation: Pass +input_file: input/input_tuple_3x2.in +*/ + +function main(a: [u8; (3, 2)]) -> bool { + return a == [0u8; (3, 2)]; } diff --git a/tests/compiler/array/input_tuple_3x2_fail.leo b/tests/compiler/array/input_tuple_3x2_fail.leo index 4c3c001f41..b1d48fef02 100644 --- a/tests/compiler/array/input_tuple_3x2_fail.leo +++ b/tests/compiler/array/input_tuple_3x2_fail.leo @@ -1,3 +1,9 @@ -function main(a: [u8; (3, 2)]) { - console.assert(a == [0u8; (3, 2)]); +/* +namespace: Compile +expectation: Fail +input_file: input/input_tuple_3x2_fail.in +*/ + +function main(a: [u8; (3, 2)]) -> bool { + return a == [0u8; (3, 2)]; } diff --git a/tests/compiler/array/mod.rs b/tests/compiler/array/mod.rs deleted file mode 100644 index 7acbd1af2f..0000000000 --- a/tests/compiler/array/mod.rs +++ /dev/null @@ -1,716 +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 . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - get_output, - parse_program, - parse_program_with_input, - EdwardsTestCompiler, -}; - -pub fn output_ones(program: EdwardsTestCompiler) { - let expected = include_bytes!("output/registers_ones.out"); - let actual = get_output(program); - - assert!(expected.eq(actual.bytes().as_slice())); -} - -pub fn output_zeros(program: EdwardsTestCompiler) { - let expected = include_bytes!("output/registers_zeros.out"); - let actual = get_output(program); - - assert!(expected.eq(actual.bytes().as_slice())); -} - -// Registers - -#[test] -fn test_registers() { - let program_string = include_str!("registers.leo"); - let ones_input_string = include_str!("input/registers_ones.in"); - let zeros_input_string = include_str!("input/registers_zeros.in"); - - // test ones input register => ones output register - let program = parse_program_with_input(program_string, ones_input_string).unwrap(); - - output_ones(program); - - // test zeros input register => zeros output register - let program = parse_program_with_input(program_string, zeros_input_string).unwrap(); - - output_zeros(program); -} - -// Expressions - -#[test] -fn test_inline() { - let program_string = include_str!("inline.leo"); - let input_string = include_str!("input/three_ones.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_nested() { - let program_string = include_str!("nested.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_inline_fail() { - let program_string = include_str!("inline.leo"); - let program = parse_program(program_string).unwrap(); - - let _err = expect_compiler_error(program); -} - -#[test] -fn test_initializer() { - let program_string = include_str!("initializer.leo"); - let input_string = include_str!("input/three_ones.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_initializer_fail() { - let program_string = include_str!("initializer_fail.leo"); - let input_string = include_str!("input/three_ones.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_initializer_input() { - let program_string = include_str!("initializer_input.leo"); - let input_string = include_str!("input/six_zeros.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_initializer_input_fail() { - let program_string = include_str!("initializer_input.leo"); - let input_string = include_str!("input/initializer_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_nested_3x2() { - let program_string = include_str!("input_nested_3x2.leo"); - let input_string = include_str!("input/input_nested_3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_nested_3x2_fail() { - let program_string = include_str!("input_nested_3x2_fail.leo"); - let input_string = include_str!("input/input_nested_3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_tuple_3x2() { - let program_string = include_str!("input_tuple_3x2.leo"); - let input_string = include_str!("input/input_tuple_3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_tuple_3x2_fail() { - let program_string = include_str!("input_tuple_3x2_fail.leo"); - let input_string = include_str!("input/input_tuple_3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_multi_fail_initializer() { - let program_string = include_str!("multi_fail_initializer.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_multi_inline_fail() { - let program_string = include_str!("multi_fail_inline.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_multi_initializer() { - let program_string = include_str!("multi_initializer.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_multi_initializer_fail() { - let program_string = include_str!("multi_initializer_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_nested_3x2_value() { - let program_string = include_str!("nested_3x2_value.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_nested_3x2_value_fail() { - let program_string = include_str!("nested_3x2_value_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_tuple_3x2_value() { - let program_string = include_str!("tuple_3x2_value.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_tuple_3x2_value_fail() { - let program_string = include_str!("tuple_3x2_value_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_spread() { - let program_string = include_str!("spread.leo"); - let input_string = include_str!("input/three_ones.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_slice() { - let program_string = include_str!("slice.leo"); - let input_string = include_str!("input/three_ones.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_slice_lower() { - let program_string = include_str!("slice_lower.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -// Array type tests - -#[test] -fn test_type_fail() { - let program_string = include_str!("type_fail.leo"); - let syntax_error = parse_program(program_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_type_nested_value_nested_3x2() { - let program_string = include_str!("type_nested_value_nested_3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_nested_value_nested_3x2_fail() { - let program_string = include_str!("type_nested_value_nested_3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_type_nested_value_nested_4x3x2() { - let program_string = include_str!("type_nested_value_nested_4x3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_nested_value_nested_4x3x2_fail() { - let program_string = include_str!("type_nested_value_nested_4x3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_type_nested_value_tuple_3x2() { - let program_string = include_str!("type_nested_value_tuple_3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_nested_value_tuple_3x2_fail() { - let program_string = include_str!("type_nested_value_tuple_3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_type_nested_value_tuple_4x3x2() { - let program_string = include_str!("type_nested_value_tuple_4x3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_nested_value_tuple_4x3x2_fail() { - let program_string = include_str!("type_nested_value_tuple_4x3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_type_tuple_value_nested_3x2() { - let program_string = include_str!("type_tuple_value_nested_3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_tuple_value_nested_3x2_fail() { - let program_string = include_str!("type_tuple_value_nested_3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_type_tuple_value_nested_4x3x2() { - let program_string = include_str!("type_tuple_value_nested_4x3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_tuple_value_nested_4x3x2_fail() { - let program_string = include_str!("type_tuple_value_nested_4x3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_type_tuple_value_tuple_3x2() { - let program_string = include_str!("type_tuple_value_tuple_3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_tuple_value_tuple_3x2_fail() { - let program_string = include_str!("type_tuple_value_tuple_3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_type_tuple_value_tuple_4x3x2() { - let program_string = include_str!("type_tuple_value_tuple_4x3x2.leo"); - let program = parse_program(program_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_type_tuple_value_tuple_4x3x2_fail() { - let program_string = include_str!("type_tuple_value_tuple_4x3x2_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -// Tests for nested multi-dimensional arrays as input to the program - -#[test] -fn test_input_type_nested_value_nested_3x2() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_nested_value_nested_3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_type_nested_value_nested_3x2_fail() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_nested_value_nested_3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_type_nested_value_nested_4x3x2() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_nested_value_nested_4x3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_type_nested_value_nested_4x3x2_fail() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_nested_value_nested_4x3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_type_nested_value_tuple_3x2() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_nested_value_tuple_3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_type_nested_value_tuple_3x2_fail() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_nested_value_tuple_3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_type_nested_value_tuple_4x3x2() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_nested_value_tuple_4x3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program) -} - -#[test] -fn test_input_type_nested_value_tuple_4x3x2_fail() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_nested_value_tuple_4x3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -// Tests for multi-dimensional arrays using tuple syntax as input to the program - -#[test] -fn test_input_type_tuple_value_nested_3x2() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_tuple_value_nested_3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_type_tuple_value_nested_3x2_fail() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_tuple_value_nested_3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_type_tuple_value_nested_4x3x2() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_tuple_value_nested_4x3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_type_tuple_value_nested_4x3x2_fail() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_tuple_value_nested_4x3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_type_tuple_value_tuple_3x2() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_tuple_value_tuple_3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_type_tuple_value_tuple_3x2_fail() { - let program_string = include_str!("type_input_3x2.leo"); - let input_string = include_str!("input/type_tuple_value_tuple_3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_input_type_tuple_value_tuple_4x3x2() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_tuple_value_tuple_4x3x2.in"); - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_input_type_tuple_value_tuple_4x3x2_fail() { - let program_string = include_str!("type_input_4x3x2.leo"); - let input_string = include_str!("input/type_tuple_value_tuple_4x3x2_fail.in"); - let syntax_error = parse_program_with_input(program_string, input_string).is_err(); - - assert!(syntax_error); -} - -#[test] -fn test_variable_slice_fail() { - let program_string = include_str!("variable_slice_fail.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_array_index() { - let program_string = r#" - function main(i: u32) { - let b = [1u8, 2, 3, 4]; - - console.assert(2 == b[i]); - console.assert(3 == b[2]); - } - "#; - let input_string = r#" - [main] - i: u32 = 1; - "#; - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_array_index_bounds_fail() { - let program_string = r#" - function main(i: u32) { - let b = [1u8, 2, 3, 4]; - - console.assert(2 == b[i]); - } - "#; - let input_string = r#" - [main] - i: u32 = 4; - "#; - let program = parse_program_with_input(program_string, input_string).unwrap(); - - expect_compiler_error(program); -} - -#[test] -fn test_const_array_index_bounds_fail() { - let program_string = r#" - function main() { - let b = [1u8, 2, 3, 4]; - const i: u32 = 4; - - console.assert(2 == b[i]); - } - "#; - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_array_range_index() { - let program_string = r#" - function main(i: u32) { - let b = [1u8, 2, 3, 4]; - - console.assert([1u8, 2] == b[0..i]); - console.assert([3u8, 4] == b[i..4]); - } - "#; - let input_string = r#" - [main] - i: u32 = 2; - "#; - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_array_range_index_dyn() { - let program_string = r#" - function main(i: u32) { - let b = [1u8, 2, 3, 4]; - - console.assert([1u8, 2] == b[..i]); - console.assert([3u8, 4] == b[i..]); - } - "#; - let input_string = r#" - [main] - i: u32 = 2; - "#; - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_array_range_index_full_dyn() { - let program_string = r#" - function main(i: u32, y: u32) { - let b = [1u8, 2, 3, 4]; - - console.assert([3u8, 4] == b[i..y]); - } - "#; - let input_string = r#" - [main] - i: u32 = 2; - y: u32 = 4; - "#; - let program = parse_program_with_input(program_string, input_string).unwrap(); - - assert_satisfied(program); -} - -#[test] -fn test_array_range_index_out_of_bounds_fail() { - let program_string = r#" - function main() { - let b = [1u8, 2, 3, 4]; - - console.assert([1, 2] == b[3..5]); - } - "#; - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_array_range_index_invalid_bounds_fail() { - let program_string = r#" - function main() { - let b = [1u8, 2, 3, 4]; - - console.assert([1, 2] == b[2..1]); - } - "#; - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - -#[test] -fn test_array_range_index_full_dyn_resized_fail() { - let program_string = r#" - function main(i: u32, y: u32) { - let b = [1u8, 2, 3, 4]; - - console.assert([3u8, 4] == b[i..y]); - } - "#; - let input_string = r#" - [main] - i: u32 = 1; - y: u32 = 4; - "#; - let program = parse_program_with_input(program_string, input_string).unwrap(); - - expect_compiler_error(program); -} - -#[test] -fn test_array_range_index_full_dyn_bounds_fail() { - let program_string = r#" - function main(i: u32, y: u32) { - let b = [1u8, 2, 3, 4]; - - console.assert([3u8, 4] == b[i..y]); - } - "#; - let input_string = r#" - [main] - i: u32 = 3; - y: u32 = 5; - "#; - let program = parse_program_with_input(program_string, input_string).unwrap(); - - expect_compiler_error(program); -} diff --git a/tests/compiler/array/multi_fail_initializer.leo b/tests/compiler/array/multi_fail_initializer.leo index be1ab315bd..464736f85f 100644 --- a/tests/compiler/array/multi_fail_initializer.leo +++ b/tests/compiler/array/multi_fail_initializer.leo @@ -1,3 +1,10 @@ -function main() { +/* +namespace: Compile +expectation: Fail +input_file: input/dummy.in +*/ + +function main() -> bool { const arr: [u8; (2, 2)] = [[1u8; 2]; 1]; // incorrect dimensions -} \ No newline at end of file + return false; +} diff --git a/tests/compiler/array/multi_fail_inline.leo b/tests/compiler/array/multi_fail_inline.leo index 49c9296798..10ee6634ab 100644 --- a/tests/compiler/array/multi_fail_inline.leo +++ b/tests/compiler/array/multi_fail_inline.leo @@ -1,4 +1,11 @@ -function main() { +/* +namespace: Compile +expectation: Fail +input_file: input/dummy.in +*/ + +function main() -> bool { const arr: [u8; (2, 2)] = [[1u8, 1u8], [1u8]]; // incorrect dimensions -} \ No newline at end of file + return false; +} diff --git a/tests/compiler/array/multi_initializer.leo b/tests/compiler/array/multi_initializer.leo index 6133542ef0..98faed5d05 100644 --- a/tests/compiler/array/multi_initializer.leo +++ b/tests/compiler/array/multi_initializer.leo @@ -1,7 +1,12 @@ -function main() { - const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)]; +/* +namespace: Compile +expectation: Pass +input_file: input/dummy.in +*/ +function main(y: bool) -> bool { + const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)]; const b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2]; - console.assert(a == b); -} \ No newline at end of file + return a == b == y; +} diff --git a/tests/compiler/array/multi_initializer_fail.leo b/tests/compiler/array/multi_initializer_fail.leo index e38a8fdaee..b99fcee93c 100644 --- a/tests/compiler/array/multi_initializer_fail.leo +++ b/tests/compiler/array/multi_initializer_fail.leo @@ -1,3 +1,10 @@ -function main() { +/* +namespace: Compile +expectation: Fail +input_file: input/dummy.in +*/ + +function main() -> bool { const arr: [u8; (2, 2)] = [1u8; (2, 1)]; // incorrect dimensions -} \ No newline at end of file + return false; +} diff --git a/tests/compiler/array/nested.leo b/tests/compiler/array/nested.leo index 80fc5511bf..e384518b01 100644 --- a/tests/compiler/array/nested.leo +++ b/tests/compiler/array/nested.leo @@ -1,4 +1,12 @@ -function main () { +/* +namespace: Compile +expectation: Pass +input_file: input/dummy.in +*/ + +function main(n: bool) -> bool { const x = [false; (2, 2)]; - const y: bool = x[0][0]; + const z: bool = x[0][0]; + + return n == z; } diff --git a/tests/compiler/array/nested_3x2_value.leo b/tests/compiler/array/nested_3x2_value.leo index c5f64c997e..85693cc6b7 100644 --- a/tests/compiler/array/nested_3x2_value.leo +++ b/tests/compiler/array/nested_3x2_value.leo @@ -1,8 +1,13 @@ -// Multidimensional array syntax in leo -function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline +/* +namespace: Compile +expectation: Pass +input_file: input/dummy.in +*/ +// Multidimensional array syntax in leo +function main(y: bool) -> bool { + const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline const b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer - console.assert(a == b); -} \ No newline at end of file + return a == b == y; +} diff --git a/tests/compiler/array/nested_3x2_value_fail.leo b/tests/compiler/array/nested_3x2_value_fail.leo index a187a51991..f05d9517a3 100644 --- a/tests/compiler/array/nested_3x2_value_fail.leo +++ b/tests/compiler/array/nested_3x2_value_fail.leo @@ -1,4 +1,12 @@ +/* +namespace: Compile +expectation: Fail +input_file: input/dummy.in +*/ + + // Multidimensional array syntax in leo -function main() { +function main(y: bool) -> bool { const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) + return false; } diff --git a/tests/compiler/array/registers.leo b/tests/compiler/array/registers.leo index 98d129207f..254c8a8d22 100644 --- a/tests/compiler/array/registers.leo +++ b/tests/compiler/array/registers.leo @@ -1,3 +1,11 @@ -function main() -> [u8; 3] { - return input.registers.r; +/* +namespace: Compile +expectation: Pass +input_file: + - input/registers_ones.in + - input/registers_zeros.in +*/ + +function main(a: [u8; 3]) -> [u8; 3] { + return input.registers.r == a ? [3,2,1] : [1,2,3]; } diff --git a/tests/compiler/array/slice.leo b/tests/compiler/array/slice.leo index 9ff83dbbb8..9841cf4c52 100644 --- a/tests/compiler/array/slice.leo +++ b/tests/compiler/array/slice.leo @@ -1,6 +1,11 @@ -// `{from}..{to}` copies the elements of one array into another exclusively -function main(a: [u8; 3]) { - const b = [1u8; 4]; +/* +namespace: Compile +expectation: Pass +input_file: input/three_ones.in +*/ - console.assert(a == b[0..3]); +// `{from}..{to}` copies the elements of one array into another exclusively +function main(a: [u8; 3]) -> bool { + const b = [1u8; 4]; + return a == b[0..3]; } diff --git a/tests/compiler/array/slice_lower.leo b/tests/compiler/array/slice_lower.leo index 0af6fbd937..cea4bf1484 100644 --- a/tests/compiler/array/slice_lower.leo +++ b/tests/compiler/array/slice_lower.leo @@ -1,8 +1,14 @@ -function main() { +/* +namespace: Compile +expectation: Pass +input_file: input/dummy.in +*/ + +function main(y: bool) -> bool { const arr: [u32; 9] = [0, 1, 2, 3, 4, 5, 6, 7, 8]; const expected: [u32; 2] = [0, 1]; const actual = arr[..2]; // Should produce [0, 1] - console.assert(expected == actual); -} \ No newline at end of file + return expected == actual == y; +} diff --git a/tests/compiler/array/spread.leo b/tests/compiler/array/spread.leo index 8bd2861aae..3236476099 100644 --- a/tests/compiler/array/spread.leo +++ b/tests/compiler/array/spread.leo @@ -1,7 +1,13 @@ +/* +namespace: Compile +expectation: Pass +input_file: input/three_ones.in +*/ + // A spread operator `...` copies the elements of one array into another -function main(a: [u8; 3]) { +function main(a: [u8; 3]) -> bool { const b = [1u8, 1u8]; const c = [1u8, ...b]; - console.assert(a == c); -} \ No newline at end of file + return a == c; +} diff --git a/tests/compiler/array/tuple_3x2_value.leo b/tests/compiler/array/tuple_3x2_value.leo index b6659539d5..4e23eaaca2 100644 --- a/tests/compiler/array/tuple_3x2_value.leo +++ b/tests/compiler/array/tuple_3x2_value.leo @@ -1,8 +1,13 @@ -// Multidimensional array syntax in leo -function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline +/* +namespace: Compile +expectation: Pass +input_file: input/dummy.in +*/ +// Multidimensional array syntax in leo +function main(y: bool) -> bool { + const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline const b: [u32; (3, 2)] = [0; (3, 2)]; // initializer - console.assert(a == b); -} \ No newline at end of file + return a == b == y; +} diff --git a/tests/compiler/array/tuple_3x2_value_fail.leo b/tests/compiler/array/tuple_3x2_value_fail.leo index 78593ab696..204226ff47 100644 --- a/tests/compiler/array/tuple_3x2_value_fail.leo +++ b/tests/compiler/array/tuple_3x2_value_fail.leo @@ -1,3 +1,8 @@ +/* +namespace: Compile +expectation: Fail +*/ + // Multidimensional array syntax in leo function main() { const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) diff --git a/tests/compiler/array/type_fail.leo b/tests/compiler/array/type_fail.leo index 356bba976a..5a93752e16 100644 --- a/tests/compiler/array/type_fail.leo +++ b/tests/compiler/array/type_fail.leo @@ -1,3 +1,9 @@ +/* +namespace: Compile +expectation: Fail +*/ + + function main() { const a: [u8; -2] = [0u32; 2]; -} \ No newline at end of file +} diff --git a/tests/expectations/compiler/compiler/array/input_nested_3x2.leo.out b/tests/expectations/compiler/compiler/array/input_nested_3x2.leo.out new file mode 100644 index 0000000000..9cf2626dba --- /dev/null +++ b/tests/expectations/compiler/compiler/array/input_nested_3x2.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 95 + num_constraints: 95 + at: 5884e806c47756fa1d12f47e5cc5249843d8de4e2fafcb373c5a0d67dfe22d69 + bt: 983c734b40e342144d6b4d52e315da9ff9f97580f019f606403924bb977a5be7 + ct: 49f0db71bd29b80dbe5f2f96573a5959b1df339c92350e16f111bade214037aa + output: + - input_file: input/input_nested_3x2.in + output: + registers: + x: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/input_nested_3x2_fail.leo.out b/tests/expectations/compiler/compiler/array/input_nested_3x2_fail.leo.out index e99d996ed2..fe2d945a7a 100644 --- a/tests/expectations/compiler/compiler/array/input_nested_3x2_fail.leo.out +++ b/tests/expectations/compiler/compiler/array/input_nested_3x2_fail.leo.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - " --> /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 ')'" + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/input_nested_3x2_fail.leo:4:29\n |\n 4 | return a == [[0u8; 2]; 3)]; // This should be written the right way as this test is for the input file.\n | ^\n |\n = expected ']' -- got ')'" diff --git a/tests/expectations/compiler/compiler/array/input_tuple_3x2.leo.out b/tests/expectations/compiler/compiler/array/input_tuple_3x2.leo.out new file mode 100644 index 0000000000..1650b2cd83 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/input_tuple_3x2.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 95 + num_constraints: 95 + at: 5884e806c47756fa1d12f47e5cc5249843d8de4e2fafcb373c5a0d67dfe22d69 + bt: 983c734b40e342144d6b4d52e315da9ff9f97580f019f606403924bb977a5be7 + ct: 49f0db71bd29b80dbe5f2f96573a5959b1df339c92350e16f111bade214037aa + output: + - input_file: input/input_tuple_3x2.in + output: + registers: + x: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/input_tuple_3x2_fail.leo.out b/tests/expectations/compiler/compiler/array/input_tuple_3x2_fail.leo.out new file mode 100644 index 0000000000..995afe29e0 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/input_tuple_3x2_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - aborting due to syntax error diff --git a/tests/expectations/compiler/compiler/array/multi_fail_initializer.leo.out b/tests/expectations/compiler/compiler/array/multi_fail_initializer.leo.out new file mode 100644 index 0000000000..6d1808725c --- /dev/null +++ b/tests/expectations/compiler/compiler/array/multi_fail_initializer.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/multi_fail_initializer.leo:4:31\n |\n 4 | const arr: [u8; (2, 2)] = [[1u8; 2]; 1]; // incorrect dimensions\n | ^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 2', received: 'array of length 1'" diff --git a/tests/expectations/compiler/compiler/array/multi_fail_inline.leo.out b/tests/expectations/compiler/compiler/array/multi_fail_inline.leo.out new file mode 100644 index 0000000000..6229b578b6 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/multi_fail_inline.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/multi_fail_inline.leo:5:35\n |\n 5 | [1u8]]; // incorrect dimensions\n | ^^^^^\n |\n = unexpected type, expected: 'array of length 2', received: 'array of length 1'" diff --git a/tests/expectations/compiler/compiler/array/multi_initializer.leo.out b/tests/expectations/compiler/compiler/array/multi_initializer.leo.out new file mode 100644 index 0000000000..b9b6741851 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/multi_initializer.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 1 + num_constraints: 1 + at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f + bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c + ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05 + output: + - input_file: input/dummy.in + output: + registers: + r0: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/multi_initializer_fail.leo.out b/tests/expectations/compiler/compiler/array/multi_initializer_fail.leo.out new file mode 100644 index 0000000000..f35aaaa775 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/multi_initializer_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/multi_initializer_fail.leo:4:31\n |\n 4 | const arr: [u8; (2, 2)] = [1u8; (2, 1)]; // incorrect dimensions\n | ^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 2', received: 'array of length 1'" diff --git a/tests/expectations/compiler/compiler/array/nested.leo.out b/tests/expectations/compiler/compiler/array/nested.leo.out new file mode 100644 index 0000000000..b9b6741851 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/nested.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 1 + num_constraints: 1 + at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f + bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c + ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05 + output: + - input_file: input/dummy.in + output: + registers: + r0: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/nested_3x2_value.leo.out b/tests/expectations/compiler/compiler/array/nested_3x2_value.leo.out new file mode 100644 index 0000000000..b9b6741851 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/nested_3x2_value.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 1 + num_constraints: 1 + at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f + bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c + ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05 + output: + - input_file: input/dummy.in + output: + registers: + r0: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/nested_3x2_value_fail.leo.out b/tests/expectations/compiler/compiler/array/nested_3x2_value_fail.leo.out new file mode 100644 index 0000000000..aea15af86c --- /dev/null +++ b/tests/expectations/compiler/compiler/array/nested_3x2_value_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/nested_3x2_value_fail.leo:6:30\n |\n 6 | const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'" diff --git a/tests/expectations/compiler/compiler/array/registers.leo.out b/tests/expectations/compiler/compiler/array/registers.leo.out new file mode 100644 index 0000000000..b9730543b0 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/registers.leo.out @@ -0,0 +1,24 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 119 + num_constraints: 143 + at: ae3e8a95d339433e8a11fc7a54536b8f56abacc03cffa1c4f4be8fa32bc4da8b + bt: 43972815ec9d0ab821613fde2cd6a5df9ee42f50758a27a0fed6dc111b44f3ee + ct: 5ed7a755b881aa851f3d3e966a4bd18dd48ce59be71b4ada39c9c891f8297201 + output: + - input_file: input/registers_ones.in + output: + registers: + r: + type: "[u8; 3]" + value: "[3, 2, 1]" + - input_file: input/registers_zeros.in + output: + registers: + r: + type: "[u8; 3]" + value: "[1, 2, 3]" diff --git a/tests/expectations/compiler/compiler/array/slice.leo.out b/tests/expectations/compiler/compiler/array/slice.leo.out new file mode 100644 index 0000000000..267848a117 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/slice.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 47 + num_constraints: 47 + at: 9034e7c6c2ae58e279196614600093d655bcdad8237302b84a66e63ec1c2f00e + bt: f23a0442b41c8901611d5f1a9a8493a0cb03c68e183a81a1b88c5a6600fa7420 + ct: ad66abc1bf940dbc76573c0a516ebf633c1411f9997101d86ded0faff025d52c + output: + - input_file: input/three_ones.in + output: + registers: + x: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/slice_lower.leo.out b/tests/expectations/compiler/compiler/array/slice_lower.leo.out new file mode 100644 index 0000000000..b9b6741851 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/slice_lower.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 1 + num_constraints: 1 + at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f + bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c + ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05 + output: + - input_file: input/dummy.in + output: + registers: + r0: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/spread.leo.out b/tests/expectations/compiler/compiler/array/spread.leo.out new file mode 100644 index 0000000000..267848a117 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/spread.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 47 + num_constraints: 47 + at: 9034e7c6c2ae58e279196614600093d655bcdad8237302b84a66e63ec1c2f00e + bt: f23a0442b41c8901611d5f1a9a8493a0cb03c68e183a81a1b88c5a6600fa7420 + ct: ad66abc1bf940dbc76573c0a516ebf633c1411f9997101d86ded0faff025d52c + output: + - input_file: input/three_ones.in + output: + registers: + x: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/tuple_3x2_value.leo.out b/tests/expectations/compiler/compiler/array/tuple_3x2_value.leo.out new file mode 100644 index 0000000000..b9b6741851 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/tuple_3x2_value.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 1 + num_constraints: 1 + at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f + bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c + ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05 + output: + - input_file: input/dummy.in + output: + registers: + r0: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/array/tuple_3x2_value_fail.leo.out b/tests/expectations/compiler/compiler/array/tuple_3x2_value_fail.leo.out new file mode 100644 index 0000000000..aa9292ed1b --- /dev/null +++ b/tests/expectations/compiler/compiler/array/tuple_3x2_value_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/tuple_3x2_value_fail.leo:5:30\n |\n 5 | const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'" diff --git a/tests/expectations/compiler/compiler/array/type_fail.leo.out b/tests/expectations/compiler/compiler/array/type_fail.leo.out new file mode 100644 index 0000000000..23f85efd45 --- /dev/null +++ b/tests/expectations/compiler/compiler/array/type_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_fail.leo:5:19\n |\n 5 | const a: [u8; -2] = [0u32; 2];\n | ^\n |\n = expected '(' -- got '-'"