diff --git a/src/test/contracts/key_hash.mligo b/src/test/contracts/key_hash.mligo new file mode 100644 index 000000000..830ea3496 --- /dev/null +++ b/src/test/contracts/key_hash.mligo @@ -0,0 +1,5 @@ +let check_hash_key (kh1, k2: key_hash * key) : bool * key_hash = + let kh2 : key_hash = Crypto.hash_key k2 in + if kh1 = kh2 + then (true, kh2) + else (false, kh2) diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 375f59423..98074e608 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1901,6 +1901,17 @@ let key_hash () : unit result = let%bind () = expect_eq program "check_hash_key" make_input make_expected in ok () +let key_hash_mligo () : unit result = + let open Tezos_crypto in + let (raw_pkh,raw_pk,_) = Signature.generate_key () in + let pkh_str = Signature.Public_key_hash.to_b58check raw_pkh in + let pk_str = Signature.Public_key.to_b58check raw_pk in + let%bind program = mtype_file "./contracts/key_hash.mligo" in + let make_input = e_pair (e_key_hash pkh_str) (e_key pk_str) in + let make_expected = e_pair (e_bool true) (e_key_hash pkh_str) in + let%bind () = expect_eq program "check_hash_key" make_input make_expected in + ok () + let curry () : unit result = let%bind program = mtype_file "./contracts/curry.mligo" in let%bind () = @@ -2035,6 +2046,7 @@ let main = test_suite "Integration (End to End)" [ test "bytes unpack (mligo)" bytes_unpack_mligo ; test "bytes unpack (religo)" bytes_unpack_religo ; test "key hash" key_hash ; + test "key hash (mligo)" key_hash_mligo ; test "chain id" chain_id ; test "type alias" type_alias ; test "function" function_ ;