quickCheckAll always return “True”

后端 未结 2 518
误落风尘
误落风尘 2021-01-12 07:37

I\'m trying to use QuickCheck following another answer. I test like this:

{-# LANGUAGE TemplateHaskell #-}
import Test.QuickCheck
import Test.QuickCheck.All

         


        
2条回答
  •  离开以前
    2021-01-12 08:06

    From the Test.QuickCheck.All docs:

    To use quickCheckAll, add a definition to your module along the lines of

    return []
    runTests = $quickCheckAll
    

    and then execute runTests.

    Note: the bizarre return [] in the example above is needed on GHC 7.8; without it, quickCheckAll will not be able to find any of the properties.

    Adding return [] before your check makes it work for me.

提交回复
热议问题