Add CameLIGO key_hash test
This commit is contained in:
parent
4ee3a29a34
commit
4fcfa3df8f
5
src/test/contracts/key_hash.mligo
Normal file
5
src/test/contracts/key_hash.mligo
Normal file
@ -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)
|
@ -1901,6 +1901,17 @@ let key_hash () : unit result =
|
|||||||
let%bind () = expect_eq program "check_hash_key" make_input make_expected in
|
let%bind () = expect_eq program "check_hash_key" make_input make_expected in
|
||||||
ok ()
|
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 curry () : unit result =
|
||||||
let%bind program = mtype_file "./contracts/curry.mligo" in
|
let%bind program = mtype_file "./contracts/curry.mligo" in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
@ -2035,6 +2046,7 @@ let main = test_suite "Integration (End to End)" [
|
|||||||
test "bytes unpack (mligo)" bytes_unpack_mligo ;
|
test "bytes unpack (mligo)" bytes_unpack_mligo ;
|
||||||
test "bytes unpack (religo)" bytes_unpack_religo ;
|
test "bytes unpack (religo)" bytes_unpack_religo ;
|
||||||
test "key hash" key_hash ;
|
test "key hash" key_hash ;
|
||||||
|
test "key hash (mligo)" key_hash_mligo ;
|
||||||
test "chain id" chain_id ;
|
test "chain id" chain_id ;
|
||||||
test "type alias" type_alias ;
|
test "type alias" type_alias ;
|
||||||
test "function" function_ ;
|
test "function" function_ ;
|
||||||
|
Loading…
Reference in New Issue
Block a user