From a11be415fa9cffdb91e134a9d028ea3d54bc25cd Mon Sep 17 00:00:00 2001 From: d0cd Date: Mon, 24 Oct 2022 22:18:22 -0700 Subject: [PATCH] Add tests; regen expectations --- tests/compiler/finalize/finalize.leo | 6 ----- .../finalize/finalize_with_return.leo | 25 +++++++++++++++++++ .../compiler/finalize/finalize.out | 8 +++--- .../finalize/finalize_with_return.out | 10 ++++++++ 4 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 tests/compiler/finalize/finalize_with_return.leo create mode 100644 tests/expectations/compiler/finalize/finalize_with_return.out diff --git a/tests/compiler/finalize/finalize.leo b/tests/compiler/finalize/finalize.leo index a61e3dda7d..e491538b93 100644 --- a/tests/compiler/finalize/finalize.leo +++ b/tests/compiler/finalize/finalize.leo @@ -15,12 +15,6 @@ program test.aleo { increment(account, receiver, amount); } - transition public_adder(public a: u8, public b: u8) { - async finalize(a, b); - } finalize public_adder(a: u8, b: u8) -> public u8 { - return a + b; - } - transition finalize_no_params() { async finalize(); } diff --git a/tests/compiler/finalize/finalize_with_return.leo b/tests/compiler/finalize/finalize_with_return.leo new file mode 100644 index 0000000000..2da973f01d --- /dev/null +++ b/tests/compiler/finalize/finalize_with_return.leo @@ -0,0 +1,25 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + mapping account: address => u64; + mapping values: u8 => u8; + + transition mint_public(public receiver: address, public amount: u64) { + async finalize(receiver, amount); + } + + finalize mint_public (public receiver: address, public amount: u64) -> u64 { + increment(account, receiver, amount); + return amount; + } + + transition public_adder(public a: u8, public b: u8) { + async finalize(a, b); + } finalize public_adder(a: u8, b: u8) -> public u8 { + return a + b; + } + +} diff --git a/tests/expectations/compiler/finalize/finalize.out b/tests/expectations/compiler/finalize/finalize.out index 3e322847c3..9f0596de5c 100644 --- a/tests/expectations/compiler/finalize/finalize.out +++ b/tests/expectations/compiler/finalize/finalize.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: c180c2c668e316551d5c0d77e7febc4ef772872ef76c12e6e48dc61bc777f751 - unrolled_ast: c180c2c668e316551d5c0d77e7febc4ef772872ef76c12e6e48dc61bc777f751 - ssa_ast: 04b3a2544c7137c8d82bd9a0085e50b2f97f61d28a1d97f434aa46f360d46baa - flattened_ast: ab2ae56fc23c7d50ce49621b505c51a99f9ff998267ad040c9ab5d9c2b175874 + initial_ast: f5ac590daecc996e9cc6cdc278f00f98d1e3dccf206cafcdb650b7c035869730 + unrolled_ast: f5ac590daecc996e9cc6cdc278f00f98d1e3dccf206cafcdb650b7c035869730 + ssa_ast: f5ac590daecc996e9cc6cdc278f00f98d1e3dccf206cafcdb650b7c035869730 + flattened_ast: 6201d1691c08db31c77cc24c1ef5e53dd6c34fa22a33e149b3ab1f7368492009 diff --git a/tests/expectations/compiler/finalize/finalize_with_return.out b/tests/expectations/compiler/finalize/finalize_with_return.out new file mode 100644 index 0000000000..dd2845fea7 --- /dev/null +++ b/tests/expectations/compiler/finalize/finalize_with_return.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 111c640307a93403153d58afb9d7bc49f010b5d37f9aab4076d204700f90cf99 + unrolled_ast: 111c640307a93403153d58afb9d7bc49f010b5d37f9aab4076d204700f90cf99 + ssa_ast: 33ba61ddd5299b3d69276f0c63bbb7fda9d62875df2ad51b989800dbbe46d25a + flattened_ast: a4321379b8e6055256632271d5121fae5cfe6f55d5a92f7453b92b889aa7e2fc