Merge branch 'feature/pascaligo-balance' into 'dev'

Add ability to access balance to PascaLIGO

Closes #68

See merge request ligolang/ligo!189
This commit is contained in:
John David Pressman 2019-11-13 02:04:14 +00:00
commit 28b650d32e
3 changed files with 21 additions and 1 deletions

View File

@ -64,6 +64,7 @@ module Simplify = struct
("int" , "INT") ; ("int" , "INT") ;
("abs" , "ABS") ; ("abs" , "ABS") ;
("amount" , "AMOUNT") ; ("amount" , "AMOUNT") ;
("balance", "BALANCE") ;
("now" , "NOW") ; ("now" , "NOW") ;
("unit" , "UNIT") ; ("unit" , "UNIT") ;
("source" , "SOURCE") ; ("source" , "SOURCE") ;

View File

@ -0,0 +1,11 @@
(**
This test makes sure that the balance is accessible in PascaLIGO.
It's there to detect a regression of: https://gitlab.com/ligolang/ligo/issues/68
*)
type storage is tez
function main (const p : unit; const s: int) : list(operation) * storage is
((nil : list(operation)), balance)

View File

@ -1151,6 +1151,13 @@ let website2_mligo () : unit result =
expect_eq_n program "main" make_input make_expected expect_eq_n program "main" make_input make_expected
let balance_constant () : unit result = let balance_constant () : unit result =
let%bind program = type_file "./contracts/balance_constant.ligo" in
let input = e_tuple [e_unit () ; e_mutez 0] in
let expected = e_tuple [e_list []; e_mutez 4000000000000] in
expect_eq program "main" input expected
let balance_constant_mligo () : unit result =
let%bind program = mtype_file "./contracts/balance_constant.mligo" in let%bind program = mtype_file "./contracts/balance_constant.mligo" in
let input = e_tuple [e_unit () ; e_mutez 0] in let input = e_tuple [e_unit () ; e_mutez 0] in
let expected = e_tuple [e_list []; e_mutez 4000000000000] in let expected = e_tuple [e_list []; e_mutez 4000000000000] in
@ -1247,7 +1254,8 @@ let main = test_suite "Integration (End to End)" [
test "website1 ligo" website1_ligo ; test "website1 ligo" website1_ligo ;
test "website2 ligo" website2_ligo ; test "website2 ligo" website2_ligo ;
test "website2 (mligo)" website2_mligo ; test "website2 (mligo)" website2_mligo ;
test "balance constant (mligo)" balance_constant ; test "balance constant" balance_constant ;
test "balance constant (mligo)" balance_constant_mligo ;
test "simple_access (ligo)" simple_access_ligo; test "simple_access (ligo)" simple_access_ligo;
test "deep_access (ligo)" deep_access_ligo; test "deep_access (ligo)" deep_access_ligo;
] ]