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
I'm not sure if the title is correct or makes sense. Generally I'm having a hard time getting reasonable counter-examples.
I have some code that needs to filter a list of elements based on a provided whitelist. The test for this looks like this:
defmoduleMyTestdodefgood_fields(whitelist)dosizedfnsize->whitelist|>one_of|>list_of(min_length: size)|>map(fnlist->Enum.map(list,&Atom.to_string/1)end)endenddefwhitelistdobindscale(list_of(atom(:alphanumeric),min_length: 1),&&1*3),fnlist->constant(Enum.uniq(list))endenddescribe"whitelist/2"doproperty"returns only the whitelisted fields"docheckall \
whitelist<-whitelist(),real<-good_fields(whitelist),garbage<-scale(list_of(binary()),&&1*4)dofields=real++garbageassertFieldSelector.whitelist(fields,whitelist)==realendendendend
The actual issue is that I didn't ensure that the garbage fields were not included in the whitelist. StreamData wouldn't find this issue until I scaled both the whitelist generator and the garbage generator. Once I had done that I got this counter example:
It seems like stream_data should be able to further shrink this counter example by quite a bit. Is there some interaction between scaling and shrinking? Is there some other way to improve the shrinking here?
The text was updated successfully, but these errors were encountered:
whatyouhide
changed the title
Potential issue with shrinking when combined with scaling.
Potential issue with shrinking when combined with scaling
Mar 7, 2019
I'm not sure if the title is correct or makes sense. Generally I'm having a hard time getting reasonable counter-examples.
I have some code that needs to filter a list of elements based on a provided whitelist. The test for this looks like this:
The actual issue is that I didn't ensure that the garbage fields were not included in the whitelist. StreamData wouldn't find this issue until I scaled both the whitelist generator and the garbage generator. Once I had done that I got this counter example:
The minimal counter example is:
It seems like stream_data should be able to further shrink this counter example by quite a bit. Is there some interaction between scaling and shrinking? Is there some other way to improve the shrinking here?
The text was updated successfully, but these errors were encountered: