You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example if a key isn't defined in my key-value store, I may not want to rule out trying to get it since that's still a valid thing to do, but I also want that to be a smaller set of the cases tried.
The text was updated successfully, but these errors were encountered:
Hi! I am not sure this feature should be built-in in the framework. It sounds more like a custom generator could help achieving the same functionality. Something like:
%% Define a ratio of 10:1 between existing and non-existing keys
-define(DEFAULT_EXISTING_FREQUENCY, 10).
-define(DEFAULT_NON_EXISTING_FREQUENCY, 1).
%% Return one of the existing keys from the state. Crash if no keys are available.existing_key(S) ->elements(maps:get(keys, S)).
%% Return a key which is not in the statenon_existing_key(S) ->?SUCHTHAT(Key, term(), notlists:member(Key, maps:get(keys, S))).
%% Return either an existing or non-existing key, according to default frequencieskey(S) ->key(S, #{ existing=>?DEFAULT_EXISTING_FREQUENCY, non_existing=>?DEFAULT_NON_EXISTING_FREQUENCY }).
%% Return either an existing or non-existing key, according to custom frequencies.%% It falls back to non-existing in case the state is emptykey(S, Frequencies) ->NEFrequency=maps:get(non_existing, Frequencies, ?DEFAULT_NON_EXISTING_FREQUENCY),
EFrequency=maps:get(existing, Frequencies, ?DEFAULT_EXISTING_FREQUENCY),
casemaps:get(keys, S) of
[] -> non_existing_key(S);
_ -> frequency([{EFrequency, existing_key(S)}, {NEFrequency, non_existing_key(S)}])
end.
For example if a key isn't defined in my key-value store, I may not want to rule out trying to get it since that's still a valid thing to do, but I also want that to be a smaller set of the cases tried.
The text was updated successfully, but these errors were encountered: