module Data.Number.ER.BasicTypes.Tests.Generate
where
import Data.Number.ER.BasicTypes
import Data.Number.ER.BasicTypes.ExtendedInteger
import Data.Number.ER.BasicTypes.PlusMinus
import Test.QuickCheck hiding (two, three)
data Nat10 = Nat10 Int deriving (Show)
data Nat100 = Nat100 Int deriving (Show)
data Ix10 = Ix10 EffortIndex deriving (Show)
data Ix20 = Ix20 EffortIndex deriving (Show)
data Gran100 = Gran100 Granularity deriving (Show)
data Gran1000 = Gran1000 Granularity deriving (Show)
data SmallRatio = SmallRatio Int Int deriving (Show)
instance (Arbitrary Nat10)
where
arbitrary =
do
ix <- choose (0,10)
return $ Nat10 ix
coarbitrary (Nat10 ix) =
error "ER.BasicTypes.Tests.Generate: coarbitrary not implemented for Nat10"
instance (Arbitrary Nat100)
where
arbitrary =
do
ix <- choose (0,100)
return $ Nat100 ix
coarbitrary (Nat100 ix) =
error "ER.BasicTypes.Tests.Generate: coarbitrary not implemented for Nat100"
instance (Arbitrary Ix20)
where
arbitrary =
do
ix <- choose (2,20)
return $ Ix20 ix
coarbitrary (Ix20 ix) =
error "ER.BasicTypes.Tests.Generate: coarbitrary not implemented for Ix20"
instance (Arbitrary Ix10)
where
arbitrary =
do
ix <- choose (1,10)
return $ Ix10 ix
coarbitrary (Ix10 ix) =
error "ER.BasicTypes.Tests.Generate: coarbitrary not implemented for Ix10"
instance (Arbitrary PlusMinus)
where
arbitrary =
do
isPlus <- arbitrary
case isPlus of
True -> return Plus
False -> return Minus
coarbitrary pm =
error "ER.BasicTypes.Tests.Generate: coarbitrary not implemented for PlusMinus"
instance (Arbitrary SmallRatio)
where
arbitrary =
do
num <- choose (1000000,1000000)
denom <- choose (1,1000000)
return $ SmallRatio num denom
coarbitrary (SmallRatio num denom) =
error "ERChebPoly: Generate: Arbitrary: coarbitrary not implemented for SmallRatio"