diff options
Diffstat (limited to 'lib/crypto/test/property_test/crypto_ng_api.erl')
-rw-r--r-- | lib/crypto/test/property_test/crypto_ng_api.erl | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/lib/crypto/test/property_test/crypto_ng_api.erl b/lib/crypto/test/property_test/crypto_ng_api.erl index c3a21b0804..14753a4eba 100644 --- a/lib/crypto/test/property_test/crypto_ng_api.erl +++ b/lib/crypto/test/property_test/crypto_ng_api.erl @@ -23,35 +23,7 @@ -compile(export_all). --proptest(eqc). --proptest([triq,proper]). - --ifndef(EQC). --ifndef(PROPER). --ifndef(TRIQ). -%%-define(EQC,true). --define(PROPER,true). -%%-define(TRIQ,true). --endif. --endif. --endif. - --ifdef(EQC). --include_lib("eqc/include/eqc.hrl"). --define(MOD_eqc,eqc). - --else. --ifdef(PROPER). --include_lib("proper/include/proper.hrl"). --define(MOD_eqc,proper). --else. --ifdef(TRIQ). --define(MOD_eqc,triq). --include_lib("triq/include/triq.hrl"). - --endif. --endif. --endif. +-include_lib("common_test/include/ct_property_test.hrl"). -include("crypto_prop_generators.hrl"). @@ -62,9 +34,12 @@ prop__crypto_one_time() -> numtests(10000, ?FORALL({TextPlain, Cipher, Key, IV}, ?LET(Ciph,cipher(), {text_plain(), Ciph, key(Ciph), iv(Ciph)}), - equal(TextPlain, - full_blocks(TextPlain, Cipher), - decrypt_encrypt_one_time(Cipher, Key, IV, TextPlain)) + begin + R = equal(TextPlain, + full_blocks(TextPlain, Cipher), + decrypt_encrypt_one_time(Cipher, Key, IV, TextPlain)), + prt_inf(Cipher, TextPlain, R) + end ) ). @@ -72,12 +47,25 @@ prop__crypto_init_update() -> numtests(10000, ?FORALL({TextPlain, Cipher, Key, IV}, ?LET(Ciph,cipher(), {text_plain(), Ciph, key(Ciph), iv(Ciph)}), - equal(TextPlain, - full_blocks(TextPlain, Cipher), - decrypt_encrypt_init_update(Cipher, Key, IV, TextPlain)) - ) + begin + R = equal(TextPlain, + full_blocks(TextPlain, Cipher), + decrypt_encrypt_init_update(Cipher, Key, IV, TextPlain)), + prt_inf(Cipher, TextPlain, R) + end) ). +prt_inf(Cipher, TextPlain, R) -> + aggregate(ct_property_test:title("text lengths", + ct_property_test:print_frequency_ranges(), + fun ct:pal/2), + [iolist_size(TextPlain)], + aggregate(ct_property_test:title("ciphers", + ct_property_test:print_frequency(), + fun ct:pal/2), + [Cipher], + R)). + %%%================================================================ %%% Lib |