我QuickCheck
用来测试以下程序:
{-# LANGUAGE TemplateHaskell #-}
import Test.QuickCheck
import Test.QuickCheck.All
elementAt :: (Integral b) => [a] -> b -> a
elementAt [x] _ = x
elementAt (x:xs) 1 = x
elementAt (x:xs) b = elementAt xs (b - 1)
prop_elementAt xs b = length xs > 0 && b >= 0 && b < length xs ==> elementAt xs (b + 1) == xs !! b
main = $(quickCheckAll)
尽管反应各不相同,但我不断收到消息
*** Gave up! Passed only x tests.
这是我应该关心的事情吗?还是测试输入的性质决定了 QuickCheck 将运行多长时间?