module Test.Data.PipeliningDepth (PipeliningDepth (..)) where
import Test.QuickCheck
newtype PipeliningDepth = PipeliningDepth Int
deriving Int -> PipeliningDepth -> ShowS
[PipeliningDepth] -> ShowS
PipeliningDepth -> String
(Int -> PipeliningDepth -> ShowS)
-> (PipeliningDepth -> String)
-> ([PipeliningDepth] -> ShowS)
-> Show PipeliningDepth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PipeliningDepth -> ShowS
showsPrec :: Int -> PipeliningDepth -> ShowS
$cshow :: PipeliningDepth -> String
show :: PipeliningDepth -> String
$cshowList :: [PipeliningDepth] -> ShowS
showList :: [PipeliningDepth] -> ShowS
Show
instance Arbitrary PipeliningDepth where
arbitrary :: Gen PipeliningDepth
arbitrary = Int -> PipeliningDepth
PipeliningDepth (Int -> PipeliningDepth) -> Gen Int -> Gen PipeliningDepth
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int, Int) -> Gen Int
forall a. Random a => (a, a) -> Gen a
choose (Int
0,Int
300)
shrink :: PipeliningDepth -> [PipeliningDepth]
shrink (PipeliningDepth Int
a) = Int -> PipeliningDepth
PipeliningDepth (Int -> PipeliningDepth) -> [Int] -> [PipeliningDepth]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Bool) -> [Int] -> [Int]
forall a. (a -> Bool) -> [a] -> [a]
filter (Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
0) (Int -> [Int]
forall a. Arbitrary a => a -> [a]
shrink Int
a)