propertyForStringsFromMyCharPool :: String -> Bool
-- implementation
main = T.quickCheck propertyForStringsFromMyCharPool
Right now QuickCheck generates all kinds of strings, but I want to test my property only for strings from my pool of characters.
My output now is:
*** Failed! Falsifiable (after 3 tests and 2 shrinks):
"-"
But it is not a real failure because -
is not included in my charset and no string containing it should have been generated in the first place.
I have tried to read the read the docs of QuickCheck but they are very abstract and hard, I did not find a sloution.
I have seen a solution on StackOverflow but it seems so much code for what looks like an easy problem, that I fear it is over-engineered.
i think you can use
elements :: [a] -> Gen a
in combination with
listOf :: Gen a -> Gen [a]
so your String
generator could look something like
vowels :: Gen String
vowels = listOf (elements "aeiou")