From f3452b97069e1613d562d6fb79cd23a1dc0e4f35 Mon Sep 17 00:00:00 2001 From: collin Date: Mon, 11 Jan 2021 21:48:57 -0500 Subject: [PATCH] test program output array registers --- .../input_files/program_registers/input/array.in | 2 ++ compiler/tests/input_files/program_registers/mod.rs | 13 +++++++++++++ .../program_registers/output/registers_array.out | 2 ++ .../program_registers/registers_array.leo | 3 +++ 4 files changed, 20 insertions(+) create mode 100644 compiler/tests/input_files/program_registers/input/array.in create mode 100644 compiler/tests/input_files/program_registers/output/registers_array.out create mode 100644 compiler/tests/input_files/program_registers/registers_array.leo diff --git a/compiler/tests/input_files/program_registers/input/array.in b/compiler/tests/input_files/program_registers/input/array.in new file mode 100644 index 0000000000..a952dda5a6 --- /dev/null +++ b/compiler/tests/input_files/program_registers/input/array.in @@ -0,0 +1,2 @@ +[registers] +r2: [[u8; 4]; 2] = [[0u64, 0u64, 0u64, 0u64], [0u64, 0u64, 0u64, 0u64]]; \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/mod.rs b/compiler/tests/input_files/program_registers/mod.rs index b689265c09..894f24b810 100644 --- a/compiler/tests/input_files/program_registers/mod.rs +++ b/compiler/tests/input_files/program_registers/mod.rs @@ -38,3 +38,16 @@ fn test_registers_fail() { expect_compiler_error(program); } + +#[test] +fn test_registers_array() { + let program_string = include_str!("registers_array.leo"); + let input_string = include_str!("input/array.in"); + let expected = include_bytes!("output/registers_array.out"); + + let program = parse_program_with_input(program_string, input_string).unwrap(); + + let actual = get_output(program); + + assert!(expected.eq(actual.bytes().as_slice())); +} diff --git a/compiler/tests/input_files/program_registers/output/registers_array.out b/compiler/tests/input_files/program_registers/output/registers_array.out new file mode 100644 index 0000000000..20294ac107 --- /dev/null +++ b/compiler/tests/input_files/program_registers/output/registers_array.out @@ -0,0 +1,2 @@ +[registers] +r2: [[u8; 4]; 2] = [[1, 2, 3, 4], [5, 6, 7, 8]]; diff --git a/compiler/tests/input_files/program_registers/registers_array.leo b/compiler/tests/input_files/program_registers/registers_array.leo new file mode 100644 index 0000000000..708fa0ea61 --- /dev/null +++ b/compiler/tests/input_files/program_registers/registers_array.leo @@ -0,0 +1,3 @@ +function main () -> [[u8; 4]; 2] { + return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]] +} \ No newline at end of file