From: Michael Orlitzky Date: Mon, 26 Dec 2011 17:58:50 +0000 (-0500) Subject: Update for QuickCheck 2. X-Git-Tag: 0.0.1~15 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=9200fe5fcab505e5a331514a6ee687c6f78011b1;p=hath.git Update for QuickCheck 2. --- diff --git a/src/Bit.hs b/src/Bit.hs index 3799516..a4241bc 100644 --- a/src/Bit.hs +++ b/src/Bit.hs @@ -14,7 +14,6 @@ instance Show Bit where instance Arbitrary Bit where arbitrary = elements [ Zero, One ] - coarbitrary _ = variant 0 bit_to_int :: Bit -> Int diff --git a/src/Cidr.hs b/src/Cidr.hs index b5dc9d2..422a0ad 100644 --- a/src/Cidr.hs +++ b/src/Cidr.hs @@ -45,7 +45,6 @@ instance Arbitrary Cidr where mask <- arbitrary :: Gen Maskbits return (Cidr ipv4 mask) - coarbitrary _ = variant 0 instance Eq Cidr where cidr1 == cidr2 = (cidr1 `equivalent` cidr2) diff --git a/src/IPv4Address.hs b/src/IPv4Address.hs index 575ce0d..e72dd59 100644 --- a/src/IPv4Address.hs +++ b/src/IPv4Address.hs @@ -46,8 +46,6 @@ instance Arbitrary IPv4Address where oct4 <- arbitrary :: Gen Octet return (IPv4Address oct1 oct2 oct3 oct4) - coarbitrary _ = variant 0 - instance Maskable IPv4Address where diff --git a/src/Maskbits.hs b/src/Maskbits.hs index 59efc2d..06314e3 100644 --- a/src/Maskbits.hs +++ b/src/Maskbits.hs @@ -116,8 +116,6 @@ instance Arbitrary Maskbits where ThirtyOne, ThirtyTwo ] - coarbitrary _ = variant 0 - -- There are only 32 bits in an IPv4 address, so there diff --git a/src/Octet.hs b/src/Octet.hs index 98fcb02..7faf1d7 100644 --- a/src/Octet.hs +++ b/src/Octet.hs @@ -38,8 +38,6 @@ instance Arbitrary Octet where a8 <- arbitrary :: Gen Bit return (Octet a1 a2 a3 a4 a5 a6 a7 a8) - coarbitrary _ = variant 0 - instance Maskable Octet where apply_mask _ Maskbits.None _ = Octet.None diff --git a/test/TestSuite.hs b/test/TestSuite.hs index 3c00d06..d7cc5ff 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -1,5 +1,6 @@ +{-# LANGUAGE NoMonomorphismRestriction #-} import Test.HUnit -import Test.QuickCheck.Batch +import Test.QuickCheck (Args(..), quickCheckWith, stdArgs) import Cidr (cidr_tests, prop_all_cidrs_contain_themselves, @@ -13,11 +14,6 @@ test_suite = TestList (concat [cidr_tests, ipv4address_tests, octet_tests]) --- QuickCheck options -options = TestOptions { no_of_tests = 1000, - length_of_tests = 0, -- No time limit on tests. - debug_tests = False } - main :: IO () main = do putStrLn "HUnit" @@ -28,5 +24,9 @@ main = do putStrLn "QuickCheck" putStrLn "----------" - runTests "Cidr" options [ run prop_all_cidrs_contain_themselves, - run prop_contains_proper_intransitive] + qc prop_all_cidrs_contain_themselves + qc prop_contains_proper_intransitive + where + args :: Args + args = stdArgs { maxDiscard = 5000 } + qc = quickCheckWith args