enacl/eqc_test/enacl_ext_eqc.erl
Jesper Louis Andersen 3b9bc848e9 Move functions around. Mark untested functionality.
A lot of people who pushed functions they missed have not pushed any
kind of test cases for them. To make sure we have test coverage, I've
marked the functions we have under test and the functions we are still
missing tests for.
2018-05-21 12:27:24 +02:00

29 lines
809 B
Erlang

-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).
prop_scramble_block() ->
?FORALL({Block, Key}, {binary(16), eqc_gen:largebinary(32)},
is_binary(enacl_ext:scramble_block_16(Block, Key))).