From: Ramakrishnan Muthukrishnan Date: Sun, 26 Apr 2015 12:09:01 +0000 (+0530) Subject: QuickCheck tests now terminate successfully. X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/%22news.html/install-details.html?a=commitdiff_plain;h=308c77eccabe0f1f66959eac3bf0b1686570b0e8;p=functorrent.git QuickCheck tests now terminate successfully. The trick is to reduce the amount of data we generate for recursive types. The hint is in the QuickCheck manual. --- diff --git a/src/FuncTorrent/Bencode.hs b/src/FuncTorrent/Bencode.hs index 8b6ff52..62d4767 100644 --- a/src/FuncTorrent/Bencode.hs +++ b/src/FuncTorrent/Bencode.hs @@ -38,9 +38,9 @@ instance Arbitrary BVal where , Bstr <$> arbitrary] bval n = oneof [ Bint <$> arbitrary , Bstr <$> arbitrary - , Blist <$> vectorOf n arbitrary + , Blist <$> vectorOf n (bval (n `div` 4)) , do keys <- vectorOf n arbitrary - vals <- vectorOf n arbitrary + vals <- vectorOf n (bval (n `div` 4)) return $ Bdict $ fromList $ zip keys vals ] -- getters