Skip to content

Commit 721adfb

Browse files
added public key equality test
1 parent 9177297 commit 721adfb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ struct
2525
module Key_data = struct
2626
let public_keys = List.map (fun id -> id.public_key) ids
2727
let compared_public_keys = List.sort Key.compare public_keys
28+
29+
let equality_public_keys =
30+
List.for_all (fun pk -> Key.equal pk pk) public_keys
2831
end
2932

3033
module Key_hash_data = struct
@@ -69,6 +72,12 @@ struct
6972
Alcotest.(check' (list string))
7073
~msg:"public key comparison works"
7174
~expected:Tezos_data.compared_public_keys ~actual:compared_public_keys
75+
76+
let equality () =
77+
Alcotest.(check' bool)
78+
~msg:"public key equality works"
79+
~expected:Tezos_data.equality_public_keys
80+
~actual:Key_data.equality_public_keys
7281
end
7382

7483
module Test_key_hash_data = struct

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ let run () =
8888
test_case "compare" `Quick Test_secret_key_data.compare;
8989
test_case "equality" `Quick Test_secret_key_data.equality;
9090
] );
91-
("Public key", [ test_case "compared" `Quick Test_key_data.compare ]);
91+
( "Public key",
92+
[
93+
test_case "compared" `Quick Test_key_data.compare;
94+
test_case "equality" `Quick Test_key_data.equality;
95+
] );
9296
( "Key hash",
9397
[
9498
test_case "compare" `Quick Test_key_hash_data.compare;

0 commit comments

Comments
 (0)