dimanche 28 février 2016

Quickcheck: generate a string made of chars from a given pool

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.

Aucun commentaire:

Enregistrer un commentaire