From 5699352ce62a7c589044adaae2078df6ca4dcc1f Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 23 Jun 2023 21:03:32 -0400 Subject: [PATCH] Add tests and regen expectations --- .../compiler/group/to_x_coordinate.out | 12 ++++++------ .../compiler/group/to_y_coordinate.out | 12 ++++++------ .../execution/group_operations.out | 14 +++++++------- .../expression/access/method_function.out | 18 ++++++++++++++++++ tests/tests/compiler/group/to_x_coordinate.leo | 2 ++ tests/tests/compiler/group/to_y_coordinate.leo | 2 ++ tests/tests/execution/group_operations.leo | 4 ++++ .../expression/access/method_function.leo | 7 +++++++ 8 files changed, 52 insertions(+), 19 deletions(-) create mode 100644 tests/expectations/parser/expression/access/method_function.out create mode 100644 tests/tests/parser/expression/access/method_function.leo diff --git a/tests/expectations/compiler/group/to_x_coordinate.out b/tests/expectations/compiler/group/to_x_coordinate.out index e0b12ce010..d708a63580 100644 --- a/tests/expectations/compiler/group/to_x_coordinate.out +++ b/tests/expectations/compiler/group/to_x_coordinate.out @@ -2,11 +2,11 @@ namespace: Compile expectation: Pass outputs: - - - initial_ast: 466c3da8bb0bc3711a3071784e06a475abbd95c4afa46ce2149bdaf8fbabe6e4 - unrolled_ast: 466c3da8bb0bc3711a3071784e06a475abbd95c4afa46ce2149bdaf8fbabe6e4 - ssa_ast: 9455d0f91c594cacc93cba0358e1d40017f65765b59b18a341ea2966b4ecb1df - flattened_ast: b0caf68c1a6fe8ee511a80829ab30c35630daa28f86b4be4bf25adf1a0a367a8 - inlined_ast: b0caf68c1a6fe8ee511a80829ab30c35630daa28f86b4be4bf25adf1a0a367a8 - dce_ast: b0caf68c1a6fe8ee511a80829ab30c35630daa28f86b4be4bf25adf1a0a367a8 + - - initial_ast: 20332c6a83a3628dd4f17d8653acdf28dd8e54bcaf9cab071fda7cbbf3ff3d29 + unrolled_ast: 20332c6a83a3628dd4f17d8653acdf28dd8e54bcaf9cab071fda7cbbf3ff3d29 + ssa_ast: 2bfa5ff05133abdf9553186a96a35c8466b5a49366ea07cea92e01f30c04f769 + flattened_ast: f7fd524a8a3e98f0e01f4c71b09bea3032867a086447ea72f4cdded1a581983d + inlined_ast: f7fd524a8a3e98f0e01f4c71b09bea3032867a086447ea72f4cdded1a581983d + dce_ast: 644ec7d38093f28ca0b0908282d7ff8032f7b22a0cf98c47d5ffa0ad16f047b8 bytecode: 51e95e10668242bec30e9917715d9856da632e933c33207ee41c5ed38d6366aa warnings: "" diff --git a/tests/expectations/compiler/group/to_y_coordinate.out b/tests/expectations/compiler/group/to_y_coordinate.out index 636a1d1a5c..c182766986 100644 --- a/tests/expectations/compiler/group/to_y_coordinate.out +++ b/tests/expectations/compiler/group/to_y_coordinate.out @@ -2,11 +2,11 @@ namespace: Compile expectation: Pass outputs: - - - initial_ast: 6cc132d16506cefce980b7ecb6637bc89a6db79e90073c307dbb75a2a25e3251 - unrolled_ast: 6cc132d16506cefce980b7ecb6637bc89a6db79e90073c307dbb75a2a25e3251 - ssa_ast: 8b8a2daa8b7e32c23f2d3290ab3557b7b6d98afeb2ae55c35795de7e8180ef79 - flattened_ast: 00b4b6055c4035a3c016a88afa60f8504dec8542ad6413bd8340f75ce60564b2 - inlined_ast: 00b4b6055c4035a3c016a88afa60f8504dec8542ad6413bd8340f75ce60564b2 - dce_ast: 00b4b6055c4035a3c016a88afa60f8504dec8542ad6413bd8340f75ce60564b2 + - - initial_ast: 62e89c72fcd4f62002450d1c82060f2f662ad6e1c12a19f0e6b994c50ba0491b + unrolled_ast: 62e89c72fcd4f62002450d1c82060f2f662ad6e1c12a19f0e6b994c50ba0491b + ssa_ast: b3c38a64899eef777c4bdd38d5db3f68148334795f4e9b89449eb9148db03eb3 + flattened_ast: da24a573e4ff569e242f88f73869c2251e19bb5ae62ef602773c0a48863bb9b3 + inlined_ast: da24a573e4ff569e242f88f73869c2251e19bb5ae62ef602773c0a48863bb9b3 + dce_ast: d313e678afef867d5cbca6829c81515387bcc768eeb4044b25c7996f4d177c63 bytecode: ea2e94f0f589fac4565040575643b1b7cd7813fe513d5b09b17c191bbf0f727e warnings: "" diff --git a/tests/expectations/execution/group_operations.out b/tests/expectations/execution/group_operations.out index d8a0992f1c..b6a5e19dc9 100644 --- a/tests/expectations/execution/group_operations.out +++ b/tests/expectations/execution/group_operations.out @@ -2,13 +2,13 @@ namespace: Execute expectation: Pass outputs: - - - initial_ast: 0f695b51ab88009feefe657770a42c5e87c5406b480c48636bf96170be3cd606 - unrolled_ast: 0f695b51ab88009feefe657770a42c5e87c5406b480c48636bf96170be3cd606 - ssa_ast: 5d78ad9fd293c3227d2a7ddadff8c7c0689794fe983ab4c8370683b2ba05643e - flattened_ast: b50634e2bc12b8e27f6f6fc00cc8ab56407fdb5aec190992106cbf45143f7c96 - inlined_ast: b50634e2bc12b8e27f6f6fc00cc8ab56407fdb5aec190992106cbf45143f7c96 - dce_ast: b50634e2bc12b8e27f6f6fc00cc8ab56407fdb5aec190992106cbf45143f7c96 - bytecode: e556ad690ff212037476e85570be2afb974da528efb4688626d824a886f9013e + - - initial_ast: ccfa20fa35d720984742081098965806736ba374ad046b3aadf6d899663375da + unrolled_ast: ccfa20fa35d720984742081098965806736ba374ad046b3aadf6d899663375da + ssa_ast: ab06973a60d8da80b174deae3dc4ee88216894503e613d3ba3ecd74c7f38e408 + flattened_ast: 9a9c3bc868b2e83c0cb0822e5bbf1d6f782f7992e0b748c6390a57768c44a4a7 + inlined_ast: 9a9c3bc868b2e83c0cb0822e5bbf1d6f782f7992e0b748c6390a57768c44a4a7 + dce_ast: 9a9c3bc868b2e83c0cb0822e5bbf1d6f782f7992e0b748c6390a57768c44a4a7 + bytecode: 5c20fda21a40464a1462524cf913438776a39383a671949312f48ce8ceb2dd16 warnings: "" results: main: diff --git a/tests/expectations/parser/expression/access/method_function.out b/tests/expectations/parser/expression/access/method_function.out new file mode 100644 index 0000000000..65a3250809 --- /dev/null +++ b/tests/expectations/parser/expression/access/method_function.out @@ -0,0 +1,18 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: ToXCoordinate + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Identifier: "{\"name\":\"b\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: ToYCoordinate + span: + lo: 0 + hi: 19 diff --git a/tests/tests/compiler/group/to_x_coordinate.leo b/tests/tests/compiler/group/to_x_coordinate.leo index 1ad42ea324..4bbd40f38b 100644 --- a/tests/tests/compiler/group/to_x_coordinate.leo +++ b/tests/tests/compiler/group/to_x_coordinate.leo @@ -5,6 +5,8 @@ expectation: Pass program test.aleo { transition main(a: group) -> field { + let x: field = a.to_x_coordinate(); + let y: field = 0group.to_y_coordinate(); return group::to_x_coordinate(a); } } diff --git a/tests/tests/compiler/group/to_y_coordinate.leo b/tests/tests/compiler/group/to_y_coordinate.leo index 236f44e733..3687999cc0 100644 --- a/tests/tests/compiler/group/to_y_coordinate.leo +++ b/tests/tests/compiler/group/to_y_coordinate.leo @@ -5,6 +5,8 @@ expectation: Pass program test.aleo { transition main(a: group) -> field { + let x: field = a.to_x_coordinate(); + let y: field = 0group.to_y_coordinate(); return group::to_y_coordinate(a); } } diff --git a/tests/tests/execution/group_operations.leo b/tests/tests/execution/group_operations.leo index 6dcdc25b27..6137a10a9e 100644 --- a/tests/tests/execution/group_operations.leo +++ b/tests/tests/execution/group_operations.leo @@ -11,8 +11,12 @@ program test.aleo { transition main(a: group) -> (field, field) { let b: field = group::to_x_coordinate(a); let c: field = a as field; + let e: field = a.to_x_coordinate(); assert_eq(b, c); + assert_eq(b, e); let d: field = group::to_y_coordinate(a); + let f: field = a.to_y_coordinate(); + assert_eq(d, f); return (b, d); } } diff --git a/tests/tests/parser/expression/access/method_function.leo b/tests/tests/parser/expression/access/method_function.leo new file mode 100644 index 0000000000..f2169a44c7 --- /dev/null +++ b/tests/tests/parser/expression/access/method_function.leo @@ -0,0 +1,7 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +a.to_x_coordinate() +b.to_y_coordinate()