add Dict fuzzers: dict, dict_between, dict_at_least, dict_at_most, dict_from - #25
Open
MavenRain wants to merge 1 commit into
Open
add Dict fuzzers: dict, dict_between, dict_at_least, dict_at_most, dict_from#25MavenRain wants to merge 1 commit into
MavenRain wants to merge 1 commit into
Conversation
…_most' and 'dict_from'. Covers the 'aiken/fuzz/dict' bullet points from the TODO list (aiken-lang#2). Keys are generated with 'set_between' (so they are unique), then one value is generated per key and inserted with 'dict.insert'. The key fuzzer is 'Fuzzer<ByteArray>' because 'Dict' keys are 'ByteArray' under the hood; the phantom 'key' type parameter is left free for the caller to pin. Signed-off-by: Onyeka Obi <softwareengineerasaservant@isurvivable.cv>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #24 (the
aiken/fuzz/dictbullets from #2).Adds
Dictfuzzers toaiken/fuzz, next to thesetfamily:dict(fuzz_key, fuzz_value): up to 20 elementsdict_between(fuzz_key, fuzz_value, min, max)dict_at_least(fuzz_key, fuzz_value, min)dict_at_most(fuzz_key, fuzz_value, max)dict_from(fuzz_keys, fuzz_value): one value per sampled keyDesign notes:
set_between, so they are unique and the size distribution is the documentedset_betweenone. Values are generated one per key and inserted withdict.insert.Fuzzer<ByteArray>rather than theFuzzer<k>written in TODOs #2:Dictstores keys asByteArrayinternally anddict.inserttakeskey: ByteArray. The phantomkeytype parameter is left free for the caller to pin.dict_fromcollapses duplicate keys (last generated value wins), so the result can be smaller than the sample.aiken/fuzz, not a submodule, which also avoids a name clash between afuzz/dictmodule and the stdlibdictmodule.Testing: 7 new property tests in
lib/aiken/fuzz.test.akcovering size bounds for all four size variants, key uniqueness and strict key ordering, value ranges, and duplicate collapse indict_from. Full suite: 48/48 green under the pinned compiler (v1.1.17); formatter check (fmt --check) clean under v1.1.17.