Add ReasonLIGO and CameLIGO tests for SET_DELEGATE

This commit is contained in:
John David Pressman 2019-12-17 09:50:47 -08:00
parent fdeb95288d
commit a4b1c9951d
4 changed files with 26 additions and 0 deletions

View File

@ -225,6 +225,7 @@ module Simplify = struct
| "stop" -> ok C_STOP | "stop" -> ok C_STOP
| "Operation.transaction" -> ok C_CALL | "Operation.transaction" -> ok C_CALL
| "Operation.set_delegate" -> ok C_SET_DELEGATE
| "Operation.get_contract" -> ok C_CONTRACT | "Operation.get_contract" -> ok C_CONTRACT
| "Operation.get_entrypoint" -> ok C_CONTRACT_ENTRYPOINT | "Operation.get_entrypoint" -> ok C_CONTRACT_ENTRYPOINT
| "int" -> ok C_INT | "int" -> ok C_INT

View File

@ -0,0 +1,3 @@
let main (p: key_hash) : operation list =
let unused: operation = (Operation.set_delegate (Some p)) in ([]: operation list)

View File

@ -0,0 +1,4 @@
let main = (p: key_hash) : list(operation) => {
let unused: operation = (Operation.set_delegate(Some(p)));
([]: list(operation));
} ;

View File

@ -1764,6 +1764,22 @@ let set_delegate () : unit result =
let%bind () = expect_eq program "main" (e_key_hash pkh_str) (e_typed_list [] t_operation) let%bind () = expect_eq program "main" (e_key_hash pkh_str) (e_typed_list [] t_operation)
in ok () in ok ()
let set_delegate_mligo () : unit result =
let open Tezos_crypto in
let (raw_pkh,_,_) = Signature.generate_key () in
let pkh_str = Signature.Public_key_hash.to_b58check raw_pkh in
let%bind program = mtype_file "./contracts/set_delegate.mligo" in
let%bind () = expect_eq program "main" (e_key_hash pkh_str) (e_typed_list [] t_operation)
in ok ()
let set_delegate_religo () : unit result =
let open Tezos_crypto in
let (raw_pkh,_,_) = Signature.generate_key () in
let pkh_str = Signature.Public_key_hash.to_b58check raw_pkh in
let%bind program = retype_file "./contracts/set_delegate.religo" in
let%bind () = expect_eq program "main" (e_key_hash pkh_str) (e_typed_list [] t_operation)
in ok ()
let main = test_suite "Integration (End to End)" [ let main = test_suite "Integration (End to End)" [
test "key hash" key_hash ; test "key hash" key_hash ;
test "chain id" chain_id ; test "chain id" chain_id ;
@ -1892,6 +1908,8 @@ let main = test_suite "Integration (End to End)" [
test "implicit account (mligo)" implicit_account_mligo ; test "implicit account (mligo)" implicit_account_mligo ;
test "implicit account (religo)" implicit_account_religo ; test "implicit account (religo)" implicit_account_religo ;
test "set delegate" set_delegate ; test "set delegate" set_delegate ;
test "set delegate (mligo)" set_delegate_mligo ;
test "set delegate (religo)" set_delegate_religo ;
test "is_nat" is_nat ; test "is_nat" is_nat ;
test "is_nat (mligo)" is_nat_mligo ; test "is_nat (mligo)" is_nat_mligo ;
test "is_nat (religo)" is_nat_religo ; test "is_nat (religo)" is_nat_religo ;