Introduce a test case for the extension code.
This commit is contained in:
parent
64832fc95d
commit
3f8979ce64
24
eqc_test/enacl_ext_eqc.erl
Normal file
24
eqc_test/enacl_ext_eqc.erl
Normal file
@ -0,0 +1,24 @@
|
||||
-module(enacl_ext_eqc).
|
||||
|
||||
-include_lib("eqc/include/eqc.hrl").
|
||||
-compile(export_all).
|
||||
|
||||
public_keypair() ->
|
||||
?LET(#{ public := PK, secret := SK}, enacl_ext:curve25519_keypair(),
|
||||
{PK, SK}).
|
||||
|
||||
prop_public_key() ->
|
||||
?FORALL({PK, SK}, public_keypair(),
|
||||
begin
|
||||
equals(PK, enacl_ext:curve25519_public_key(SK))
|
||||
end).
|
||||
|
||||
prop_shared_secret() ->
|
||||
?FORALL([{PK1, SK1}, {PK2, SK2}],
|
||||
[public_keypair(), public_keypair()],
|
||||
begin
|
||||
Alice = enacl_ext:curve25519_shared(SK1, PK2),
|
||||
Bob = enacl_ext:curve25519_shared(SK2, PK1),
|
||||
equals(Alice, Bob)
|
||||
end).
|
||||
|
Loading…
x
Reference in New Issue
Block a user