Pt 165173962 fuzz testing aefate #161

Merged
zxq9 merged 36 commits from PT-165173962-fuzz-testing-aefate into master 2019-06-04 01:37:50 +09:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit 985e5358c9 - Show all commits

View File

@ -21,5 +21,6 @@
quickcheck_test_() ->
{setup, fun() -> eqc:start() end,
[ ?EQC_EUNIT(aefate_type_eqc, prop_roundtrip, 1000),
?EQC_EUNIT(aefate_eqc, prop_serializes, 1000)
?EQC_EUNIT(aefate_eqc, prop_serializes, 1000),
?EQC_EUNIT(aefate_eqc, prop_idempotent, 1000)
]}.

View File

@ -88,10 +88,18 @@ lt_max([X, Y | Rest]) ->
end;
lt_max([X]) -> X.
prop_idempotent() ->
?FORALL(Items, list({fate_data_key(), fate_data()}),
equals(aeb_fate_encoding:sort(Items),
aeb_fate_encoding:sort(aeb_fate_encoding:sort(Items)))).
fate_data() ->
?SIZED(Size, ?LET(Data, fate_data(Size, [map, variant]), eqc_symbolic:eval(Data))).
fate_data_key() ->
?SIZED(Size, ?LET(Data, fate_data(Size div 4, []), eqc_symbolic:eval(Data))).
fate_data(0, _Options) ->
?LAZY(
oneof([fate_integer(),