Skip to content

Commit 6fcfdf9

Browse files
added key_hash comparison tests
1 parent 11fd89d commit 6fcfdf9

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

deku-p/src/core/crypto/tests/alg_intf_tests.ml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ struct
2222
List.for_all (fun sk -> Secret.equal sk sk) secret_keys
2323
end
2424

25+
module Key_hash_data = struct
26+
let key_hashes = List.map (fun id -> id.public_key_hash) ids
27+
let compared_key_hashes = List.sort Key_hash.compare key_hashes
28+
end
29+
2530
module Test_secret_key_data = struct
2631
let public_keys () =
2732
let public_keys =
@@ -47,4 +52,16 @@ struct
4752
~expected:Tezos_data.equality_secret_keys
4853
~actual:Secret_key_data.equality_secret_keys
4954
end
55+
56+
module Test_key_hash_data = struct
57+
let compare () =
58+
let compared_key_hashes =
59+
List.map
60+
(fun kh -> Key_hash.to_b58 kh)
61+
Key_hash_data.compared_key_hashes
62+
in
63+
Alcotest.(check' (list string))
64+
~msg:"key hash comparison works"
65+
~expected:Tezos_data.compared_key_hashes ~actual:compared_key_hashes
66+
end
5067
end

deku-p/src/core/crypto/tests/test_ed25519.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,5 @@ let run () =
8888
test_case "compare" `Quick Test_secret_key_data.compare;
8989
test_case "equality" `Quick Test_secret_key_data.equality;
9090
] );
91+
("Key hash", [ test_case "compare" `Quick Test_key_hash_data.compare ]);
9192
]

0 commit comments

Comments
 (0)