Digit-0.0.1: Test/Data/Digit.hs
module Test.Data.Digit where
import Data.Digit
import Test.QuickCheck
import Test.Framework
import Test.Framework.Providers.QuickCheck2 (testProperty)
instance Arbitrary Digit where
arbitrary = elements [d0 .. d9]
main ::
IO ()
main =
defaultMain digitTests
digitTests ::
[Test]
digitTests =
[
testGroup "Digit"
[
testProperty "fold for Digit" prop_fold
, testProperty "fold for Digit with if" prop_if
, testProperty "even/odd Digit" prop_even_odd
]
]
prop_fold ::
Digit
-> Bool
prop_fold d =
foldDigit d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d == d
prop_if ::
Int
-> Int
-> Digit
-> Bool
prop_if x y d =
foldDigit if0 if1 if2 if3 if4 if5 if6 if7 if8 if9 d x y d == x
prop_even_odd ::
Int
-> Int
-> Digit
-> Bool
prop_even_odd x y d =
ifEven x y d == ifOdd y x d