From c6bdb1569371423f635696a656bf953f0a6b399c Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 16 Dec 2022 13:03:50 +0300 Subject: [PATCH] Add tests for all valid expressions --- test/aeso_compiler_tests.erl | 1 + test/contracts/toplevel_constants.aes | 49 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 test/contracts/toplevel_constants.aes diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index b91d115..fdb878e 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -222,6 +222,7 @@ compilable_contracts() -> "unapplied_contract_call", "unapplied_named_arg_builtin", "resolve_field_constraint_by_arity", + "toplevel_constants", "test" % Custom general-purpose test file. Keep it last on the list. ]. diff --git a/test/contracts/toplevel_constants.aes b/test/contracts/toplevel_constants.aes new file mode 100644 index 0000000..45f0a68 --- /dev/null +++ b/test/contracts/toplevel_constants.aes @@ -0,0 +1,49 @@ +contract C = + datatype event = EventX(int, string) + + record account = { name : string, + balance : int } + + let c01 = 2425 + let c02 = -5 + let c03 = ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt + let c04 = true + let c05 = Bits.none + let c06 = #fedcba9876543210 + let c07 = "str" + let c08 = [1, 2, 3] + let c09 = [(true, 24), (false, 19), (false, -42)] + let c10 = (42, "Foo", true) + let c11 = { name = "str", balance = 100000000 } + let c12 = {["foo"] = 19, ["bar"] = 42} + let c13 = Some(42) + let c14 = 11 : int + let c15 = EventX(0, "Hello") + let c16 = #000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f + let c17 = #000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f + let c18 = RelativeTTL(50) + let c19 = ok_2YNyxd6TRJPNrTcEDCe9ra59SVUdp9FR9qWC5msKZWYD9bP9z5 + let c20 = oq_2oRvyowJuJnEkxy58Ckkw77XfWJrmRgmGaLzhdqb67SKEL1gPY + let c21 = ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ : C + + entrypoint f01() = c01 + entrypoint f02() = c02 + entrypoint f03() = c03 + entrypoint f04() = c04 + entrypoint f05() = c05 + entrypoint f06() = c06 + entrypoint f07() = c07 + entrypoint f08() = c08 + entrypoint f09() = c09 + entrypoint f10() = c10 + entrypoint f11() = c11 + entrypoint f12() = c12 + entrypoint f13() = c13 + entrypoint f14() = c14 + entrypoint f15() = c15 + entrypoint f16() = c16 + entrypoint f17() = c17 + entrypoint f18() = c18 + entrypoint f19() = c19 + entrypoint f20() = c20 + entrypoint f21() = c21